You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a persistent workspaces configuration, if any workspace has not been created (i.e. does not appear in swaymsg -t get_workspaces), that workspace button will always appear first in sway.
I believe this is because since 6fe7645 the workspace num property is used for sort order, however that is not set for persistent workspaces. I believe it's therefore cast to zero, appearing first.
One consequence of this is that switching to such a workspace causes the workspace button to jump to the correct position.
The fix for this isn't obvious to me. We could set the num property to -1, which would result in these being grouped with non-numeric workspaces, and their position dependent on the numeric-first config parameter. However this behavior is a little inconsistent, as persistent workspaces may be numeric. This will still, I assume, make the workspace button jump around when changing to that workspace.
My best idea so far is to set num to the strtoi of the workspace name, or -1 if strtoi fails. This should mirror the behavior of sway, which should at least prevent the button jumping around. The downside is that if sway's behavior ever changes, this will break.
I'm open to ideas here, and happy to code up whatever is decided as the best approach.
The text was updated successfully, but these errors were encountered:
For reference, there are some comments with screenshots in the pull request that lead to this problem: #696
My best idea so far is to set num to the strtoi of the workspace name, or -1 if strtoi fails. This should mirror the behavior of sway, which should at least prevent the button jumping around.
This is something I thought of doing before discovering sway's "num" property, which was simply easier to reuse in my PR.
The downside is that if sway's behavior ever changes, this will break.
I would suggest to simply not use the "num" property anymore. If the "num" property is ignored completely by waybar and the logic of assigning a number to a workspace is duplicated in waybar, then waybar will be independent of sway's "num" assignments. Since this is only used for ordering and displaying, this should not cause too much trouble even if waybar and sway disagree on the workspace "num" in the future.
Given a persistent workspaces configuration, if any workspace has not been created (i.e. does not appear in
swaymsg -t get_workspaces
), that workspace button will always appear first in sway.I believe this is because since 6fe7645 the workspace
num
property is used for sort order, however that is not set for persistent workspaces. I believe it's therefore cast to zero, appearing first.One consequence of this is that switching to such a workspace causes the workspace button to jump to the correct position.
The fix for this isn't obvious to me. We could set the
num
property to -1, which would result in these being grouped with non-numeric workspaces, and their position dependent on thenumeric-first
config parameter. However this behavior is a little inconsistent, as persistent workspaces may be numeric. This will still, I assume, make the workspace button jump around when changing to that workspace.My best idea so far is to set
num
to thestrtoi
of the workspace name, or -1 if strtoi fails. This should mirror the behavior of sway, which should at least prevent the button jumping around. The downside is that if sway's behavior ever changes, this will break.I'm open to ideas here, and happy to code up whatever is decided as the best approach.
The text was updated successfully, but these errors were encountered: