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.
This commit is contained in:
Konstantin Pospelov 2021-01-30 10:11:09 +01:00 committed by Simon Ser
parent f8c6fc1944
commit 8b7008a296

View file

@ -270,7 +270,16 @@ found:
sway_log(SWAY_DEBUG, sway_log(SWAY_DEBUG,
"Creating workspace %s for pid %d because it disappeared", "Creating workspace %s for pid %d because it disappeared",
pw->workspace, pid); pw->workspace, pid);
ws = workspace_create(pw->output, pw->workspace);
struct sway_output *output = pw->output;
if (pw->output && !pw->output->enabled) {
sway_log(SWAY_DEBUG,
"Workspace output %s is disabled, trying another one",
pw->output->wlr_output->name);
output = NULL;
}
ws = workspace_create(output, pw->workspace);
} }
pid_workspace_destroy(pw); pid_workspace_destroy(pw);