create_workspace_on_output: Prevent duplicate workspace nums
When going through the `binding_workspace_names` to prioritize
user-specified names, we only check if the workspace exists, not the
workspace number. If the user specified a `bindsym … workspace number X`
directive, then it is appended in `binding_workspace_names` and a
workspace is created using that number even though from the POV of a
user that uses numbers to change workspaces, that workspace already
exists.
In similar code here:
1d9160f2d2/src/workspace.c (L997)
we do the check.
Fixes #4238
This commit is contained in:
parent
d0067077ed
commit
68258785ac
@ -17,5 +17,4 @@ strongly encouraged to upgrade.
|
||||
│ Bugfixes │
|
||||
└────────────────────────────┘
|
||||
|
||||
• placeholder
|
||||
|
||||
• when initializing new outputs, avoid duplicating workspace numbers
|
||||
|
@ -254,12 +254,15 @@ Con *create_workspace_on_output(Output *output, Con *content) {
|
||||
continue;
|
||||
}
|
||||
|
||||
exists = (get_existing_workspace_by_name(target_name) != NULL);
|
||||
const int num = ws_name_to_number(target_name);
|
||||
exists = (num == -1)
|
||||
? get_existing_workspace_by_name(target_name)
|
||||
: get_existing_workspace_by_num(num);
|
||||
if (!exists) {
|
||||
ws->name = sstrdup(target_name);
|
||||
/* Set ->num to the number of the workspace, if the name actually
|
||||
* is a number or starts with a number */
|
||||
ws->num = ws_name_to_number(ws->name);
|
||||
ws->num = num;
|
||||
LOG("Used number %d for workspace with name %s\n", ws->num, ws->name);
|
||||
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user