Skip to content
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

[Feature request] Automatic persistent workspaces for Hyprland #2243

Closed
zjeffer opened this issue Jun 18, 2023 · 2 comments
Closed

[Feature request] Automatic persistent workspaces for Hyprland #2243

zjeffer opened this issue Jun 18, 2023 · 2 comments

Comments

@zjeffer
Copy link
Contributor

zjeffer commented Jun 18, 2023

The current situation

I'm using this plugin to automatically manage persistent workspaces on Hyprland. It sets up keybinds so for example if I press super+3, it will go to the 3rd workspace on the current active monitor.

This works great with @MonstrousOgre's persistent_workspaces feature, where we can tell waybar which workspaces should appear on which monitor.

Say I have 3 monitors, the plugin will create 5 workspaces on every monitor and I have to look at which numbers it assigned to which monitor, so I can update my config.json with those numbers: https://github.com/zjeffer/dotfiles/blob/main/.config/hypr/apps/waybar/config.jsonc#L40

However, the problem is that if you connect a new monitor, waybar won't know which workspaces have to be assigned to it. I have to change my config.json every time a new monitor is connected. If I disconnect a monitor, the plugin might assign different numbers to the monitors that are still connected, so I need to update the config.json again to make sure they match.

My feature request

I would like:

  • Every monitor to show 5 workspaces each
  • Connecting or disconnecting monitors should update the waybar workspaces automatically
  • In the waybar config, instead of a map persistent_workspaces, the ability to specify a fixed number of workspaces for every monitor

A relatively easy fix

The plugin holds a map of all monitors and their respective workspaces, which updates automatically at startup or when a connect or disconnect happens. If we could write a way to get that map from the plugin and pass it to waybar, we could map the workspaces automatically. You wouldn't even need to specify the number of workspaces in the waybar config, waybar could just get the correct amount from the map.

What do you guys think of this idea? Before I look into making changes to the plugin's & waybar's code, is there a better way to achieve what I want?

@zjeffer
Copy link
Contributor Author

zjeffer commented Jun 20, 2023

A better idea for a fix, courtesy of @paolobettelini: instead of getting a map from the plugin, just calculate the workspaces by looking at the monitor IDs. For example, with amount_of_monitors set to 10, the monitor with ID 0 would have workspaces 1-10, while monitor with ID 2 would have workspaces 21-30. You don't need any communication between the plugin and waybar, you can just get the monitor IDs from hyprctl monitors, and the amount_of_workspaces could be set in the waybar config.

@zjeffer
Copy link
Contributor Author

zjeffer commented Jul 2, 2023

Closing in favour of #2271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant