Fails when there are duplicate workspace num
Opened this issue · 3 comments
If the current state has duplicate nums, it results on selecting one of the duplicates (the first duplicate).
In the following example, the workspace 5 is duplicated.
$ swaymsg -t get_workspaces | jq .[].num
5
9
4
10
1
2
3
4
5
7
This will result in sway-new-workspace selecting 5 instead of 6.
I'm preparing something to fix the issue.
How do you end up with duplicate num
s?
I use swaybar and I have a static set of named workspaces: 1:Browser
, 2:Chat
, etc up to 7:something
They don't have anything when they start so they are not really created until I put something in that workspace.
I have multiple screens, so if i create a workspace in other screen (using sway-new-workspace
), it will get the number (e.g. 5
) and when I come back to my main screen and put something in 5:something
is when I hit the bug.
If i try to create a new one (using sway-new-workspace
) It will redirect me to 5
instead of creating a new one.
Created an easier reproducer in case you want to check.
Reproducer:
- Create workspace 2.
sway workspace 2
- Create a workspace with name foobar and num 2.
sway workspace 2:foobar
- Check we currently have 2 workspaces with the num 2.
swaymsg -t get_workspaces | jq .[].num | grep 2
- Call
sway-new-workspace
Expected results:
It creates a new workspace
Actual results:
It opens the workspace 2 (the one without a name)