aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
authorLibravatar Konstantin Pospelov <kupospelov@gmail.com>2021-01-30 10:11:09 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2021-01-30 11:24:43 +0100
commit8b7008a2962ac44510531c066adef73e01e653eb (patch)
tree5e40873ea528f263902850a0e4f8f643ef0f60d3 /sway/tree
parentdesktop/layer_shell: Fix allocation type mismatch (diff)
downloadsway-8b7008a2962ac44510531c066adef73e01e653eb.tar.gz
sway-8b7008a2962ac44510531c066adef73e01e653eb.tar.zst
sway-8b7008a2962ac44510531c066adef73e01e653eb.zip
Check the output state for recorded workspaces
Sway records pid, workspace, and output for every new process. However, if the output gets disabled and the workspace disappears, the workspace is still re-created on the disabled output. This commit adds a check for the enabled flag, so that NULL will be passed to workspace_create() in this case.
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/root.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c
index ebd185ec..7a594538 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -270,7 +270,16 @@ found:
270 sway_log(SWAY_DEBUG, 270 sway_log(SWAY_DEBUG,
271 "Creating workspace %s for pid %d because it disappeared", 271 "Creating workspace %s for pid %d because it disappeared",
272 pw->workspace, pid); 272 pw->workspace, pid);
273 ws = workspace_create(pw->output, pw->workspace); 273
274 struct sway_output *output = pw->output;
275 if (pw->output && !pw->output->enabled) {
276 sway_log(SWAY_DEBUG,
277 "Workspace output %s is disabled, trying another one",
278 pw->output->wlr_output->name);
279 output = NULL;
280 }
281
282 ws = workspace_create(output, pw->workspace);
274 } 283 }
275 284
276 pid_workspace_destroy(pw); 285 pid_workspace_destroy(pw);