-
-
Notifications
You must be signed in to change notification settings - Fork 921
fix: Use workspace ID to handle hyprland/workspace updates #4305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
I think this is a problem for persistent workspaces. If they are not called at least once, they do not really exists and do not have a specific id from hyprland. But we still need to show them in the waybar. We can see in the code: Waybar/src/modules/hyprland/workspaces.cpp Lines 54 to 58 in 9477792
That it tries to convert the name (almost the only information we have from the persistent workspace) into an id and if it fails the id is just 0. So for example |
OK. This is something I had not thought about. I will check it out and figure out a solution. I'm writing this PR because in my 2 monitor setup, I will get a deeper understanding and get back to this. Thanks! |
|
Related discussion: hyprwm/Hyprland#3791 Otherwise, because it is also possible to have the monitor(s), maybe a tuple (name, monitor) instead of the id is possible, for example here instead of checking only the name if the id is <= 0, check the name and the monitor. Waybar/src/modules/hyprland/workspaces.cpp Lines 72 to 79 in 9477792
|
Just to give context, I'm using the following hyprland workspace config: Given this config, hyprland does create all workspaces, with their respective ids, at start time. I'm using hyprland 0.50. |
|
It is a bit weird, after some tests i think a workspace is directly created when:
So for example this: Will have x1 and 1 to be created directly, but not x2. |
|
Created an issue in hyprland hyprwm/Hyprland#11146 |
|
In the end it was a bug on Hyprland's side, after that hyprwm/Hyprland#11161 will be merged, each workspace will have its own ID and everything will be fine! |
Thanks a lot! I will then cleanup this PR and get it ready for hyprlands fix. |
06602d6 to
fa3ab26
Compare
|
I think it should be ok now with the new release of hyprland |
fa3ab26 to
06c3411
Compare
|
Hi everyone 👋 This issue still persists even with the latest Waybar commit — Waybar is currently unable to distinguish between two workspaces that share the same name. There’s also a related problem stemming from how As a result, a configuration like this: leads to Waybar creating 20 workspaces on the second monitor (DP-3). |
|
I could be wrong, but how i see the thing now with this part: Waybar/src/modules/hyprland/workspaces.cpp Lines 188 to 210 in 559079e
Every workspace (even the persistent ones) must be directly obtained in the first line. If not it is a bug from Hyprland. The "persistent" in the config of waybar ( |
06c3411 to
dc735f3
Compare
|
So in the end the goal of this PR is just to completely remove every "workspace uniqueness" management by completely relying on Hyprland's workspace id. Do you have anything else to modify @edeustua? |
|
Yes, you are correct. The end goal of this PR is to rely on hyprland to set workspace ids, which in turn waybar should use as the ground truth. I don't think there is anything else to modify. But let me know if you want me to test anything further. Again, thanks a lot for reviewing this and helping out @arnaud-ma. |
Description:
This PR fixes an issue where workspace updates in Hyprland were being handled using the workspace name, which is not guaranteed to be unique. As a result, updates could mistakenly overwrite the state of different workspaces, particularly those on other monitors that share the same name.
The fix switches the logic to use the workspace ID, which is guaranteed to be unique, ensuring that workspace updates are correctly associated with their intended targets.
Why it matters:
Using non-unique identifiers like name caused bugs where state data (e.g. layout, focus, etc.) was mismatched or overwritten across monitors. This change ensures updates behave as expected and improves overall multi-monitor workspace reliability.