-
-
Notifications
You must be signed in to change notification settings - Fork 724
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
Persistent workspaces in hyprland/workspaces #2341
Conversation
This is great! Once this is merged, I can start using this over wlr/workspaces |
I was not using window_, so I just created the var and parsed it on start. |
I opted to update all workspace's window counts whenever a window opens or closes, as I can't really see another way to do it. Seems to work pretty well, though. |
It's possible to listen to (openwindow, movewindow, closewindow) but you'd have to keep track of which window are where for it to work. |
Nevermind, still a small bug when moving a window to another workspace (even when also listening to For example, here I move a window from workspace 1 to 4, one by one: 2023-07-24.15-12-24.mp4A white background means the workspace is not empty, grey means persistent and empty. |
Ok I think I fixed it for real this time: now it will update the window counts on Ready for review. |
What about listening for |
active_workspace_name_ = (gIPC->getSocket1JsonReply("activeworkspace"))["name"].asString(); | ||
|
||
// get monitor ID from name (used by persistent workspaces) | ||
monitor_id_ = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use id here instead of desc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I use this ID to calculate the IDs the persistent workspaces should get.
I forked Duckonaut's split-monitor-workspaces
Hyprland plugin to make it possible to automatically set up keyboard shortcuts to switch to the xth workspace on the current focused monitor. The plugin calculates the IDs the workspaces should get based on the monitor ID, and here I used the same formula (because the IDs have to match).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would make more sense to use workspace name:<monitor-desc-here>_<workspace-number-here>
, monitor id can change on restart but monitor desc is persistent.
Also it's more consistent with the rest of hyprland
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But how can I then ensure both waybar and the plugin give the same name to the workspaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waybar should only use the name you set in the config file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you want waybar to work with any monitor you connect, without having to specify the name in the config file?
For example, if I connect my laptop to a monitor it has never seen before, waybar and my fork of the plugin will work together to automatically show persistent workspaces and set up the correct keybinds.
If we did it with monitor descriptions, you would have to do all that stuff manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the port name then, monitor desc is for when you can't use that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why it would be any different with the port name instead of the monitor description. I would still have to manually specify the port name in the configs.
In the plugin, I use the formula workspace_name = (monitor_ID * amount_of_workspaces) + index + 1
. Here, I use the same formula so that any monitor I connect, both the plugin and the monitor will assign the same index to the same workspace ID (with 5 workspaces per monitor, the 4th workspace on the monitor with ID 2 will have workspace ID = 2*5 + 3 + 1 = 14).
I don't see how I can implement the same functionality with port names or monitor desc. I'm open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simply use named workspaces, containing the monitor name and a number (name:<monitor-desc-here>_<workspace-number-here>
)
this way you wouldn't rely on using initial id, which depends on the order you connect the monitors
if you want every monitor you connect on DP-1 (for example) to have the same configuration you would use DP-1 in the config
if you want each monitor you connect on DP-1 (for example) to have a different config you could use the monitor description
using id gives you much less control than either of these options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to understand. But I think changing it to use monitor descriptions might be more appropriate for another PR, as a lot of things would need to be refactored for it to work. Not to mention the changes I would have to make to the plugin.
I think we can merge this if you agree? CC @Alexays
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b9cb08b
to
6006535
Compare
Adds
persistent_workspaces
to the hyprland/workspaces module, based on the implementation from wlr/workspaces.Apart from what's possible with wlr/workspaces (specifying an array of monitors a workspace should be shown on), you can also specify a fixed number of workspaces each monitor should have, like this:
CC: @MonstrousOgre @Anakael @MightyPlaza