randr: Skip workspaces which are assigned to a different output when creating a new workspace
If you had workspace 1, 2, 3, 4 on LVDS1 and you enabled HDMI2 (where workspace 1 to workspace 5 are assigned to HDMI2), i3 would look for a new workspace for LVDS1 (since all workspaces were moved), create workspace 5, move that over due to assignment and then create workspace 6. Effectively, you would end up with an empty workspace 5.
This commit is contained in:
parent
8cffde232f
commit
c1e0c38b27
16
src/randr.c
16
src/randr.c
|
@ -439,6 +439,22 @@ void init_ws_for_output(Output *output, Con *content) {
|
|||
ws->name[strlen(ws->name)-1] = '\0';
|
||||
DLOG("trying name *%s*\n", ws->name);
|
||||
|
||||
/* Ensure that this workspace is not assigned to a different output —
|
||||
* otherwise we would create it, then move it over to its output, then
|
||||
* find a new workspace, etc… */
|
||||
bool assigned = false;
|
||||
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
|
||||
if (strcmp(assignment->name, ws->name) != 0 ||
|
||||
strcmp(assignment->output, output->name) == 0)
|
||||
continue;
|
||||
|
||||
assigned = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (assigned)
|
||||
continue;
|
||||
|
||||
current = NULL;
|
||||
TAILQ_FOREACH(out, &(croot->nodes_head), nodes)
|
||||
GREP_FIRST(current, output_get_content(out), !strcasecmp(child->name, ws->name));
|
||||
|
|
Loading…
Reference in New Issue