aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-06-18 22:27:57 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2019-06-19 07:40:52 +0300
commit5069b53d6c561d0f949cb0aec1d70397a2fb8a90 (patch)
tree9738ba995d5a520560fc4262ff7b025d6bfaf71e
parentFix sway crashes for scratchpad layouts (diff)
downloadsway-5069b53d6c561d0f949cb0aec1d70397a2fb8a90.tar.gz
sway-5069b53d6c561d0f949cb0aec1d70397a2fb8a90.tar.zst
sway-5069b53d6c561d0f949cb0aec1d70397a2fb8a90.zip
config/xwayland: retain xwayland status on reload
Since xwayland can only be enabled/disabled at launch, the xwayland status should be retained on reload. Having `xwayland enabled|disabled` in the config, should not cause `config->xwayland` to be invalid on reload. This also returns `CMD_FAILURE` with a message that xwayland can only be enabled/disabled on launch when trying to set the invalid status on reload. This allows swaynag to notify the user that the change will not take effect until sway is restarted.
-rw-r--r--sway/commands/xwayland.c7
-rw-r--r--sway/config.c5
2 files changed, 11 insertions, 1 deletions
diff --git a/sway/commands/xwayland.c b/sway/commands/xwayland.c
index b72f3239..62293276 100644
--- a/sway/commands/xwayland.c
+++ b/sway/commands/xwayland.c
@@ -11,7 +11,12 @@ struct cmd_results *cmd_xwayland(int argc, char **argv) {
11 } 11 }
12 12
13#ifdef HAVE_XWAYLAND 13#ifdef HAVE_XWAYLAND
14 config->xwayland = parse_boolean(argv[0], config->xwayland); 14 bool xwayland = parse_boolean(argv[0], true);
15 if (config->reloading && config->xwayland != xwayland) {
16 return cmd_results_new(CMD_FAILURE,
17 "xwayland can only be enabled/disabled at launch");
18 }
19 config->xwayland = xwayland;
15#else 20#else
16 sway_log(SWAY_INFO, "Ignoring `xwayland` command, " 21 sway_log(SWAY_INFO, "Ignoring `xwayland` command, "
17 "sway hasn't been built with Xwayland support"); 22 "sway hasn't been built with Xwayland support");
diff --git a/sway/config.c b/sway/config.c
index 4e64bd3a..70f2d706 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -441,6 +441,11 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
441 config->reloading = true; 441 config->reloading = true;
442 config->active = true; 442 config->active = true;
443 443
444 // xwayland can only be enabled/disabled at launch
445 sway_log(SWAY_DEBUG, "xwayland will remain %s",
446 old_config->xwayland ? "enabled" : "disabled");
447 config->xwayland = old_config->xwayland;
448
444 if (old_config->swaybg_client != NULL) { 449 if (old_config->swaybg_client != NULL) {
445 wl_client_destroy(old_config->swaybg_client); 450 wl_client_destroy(old_config->swaybg_client);
446 } 451 }