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

Persistent workspaces on monitors #658

Closed
Diaoul opened this issue Sep 11, 2022 · 12 comments
Closed

Persistent workspaces on monitors #658

Diaoul opened this issue Sep 11, 2022 · 12 comments

Comments

@Diaoul
Copy link

Diaoul commented Sep 11, 2022

Hi 👋 and thanks for developing such a beautiful window manager 👍

A bit of context first

  • I come from BSPWM and I use between 1 and 3 monitors depending on where I am
  • I work with 10 workspaces automatically created and dynamically rearranged on monitor plug/unplug (script here) e.g.
    • with 1 monitor (on the laptop alone) I have workspaces 1-10 available
    • with 2 monitors I have 1-5 on the first one, 6-10 on the second one
    • with 3 monitors I have 1-3 on the 1st, 4-7 on the 2nd and 8-10 on the 3rd

Usage

  • I put my main stuff on the "middle" where it's likely that I will have it on the main monitor. e.g. browser on workspace 4, terminal on 3
  • When I move around and unplug my other monitors, the workspaces are just rearranged on the remaining monitors but they keep their number so I know where's what and it's not a big mess

Feature Request?

It does not seem that Hyperland allows this behavior as empty workspaces are destroyed. It seems that there have been similar questions in #654 and #349 but the workaround is to move the workspace to the right monitor upon creation. Or maybe I missed something?

I would like Hyperland to NOT destroy empty workspaces and allow their creation with hyprctl. This way I can create them where I want and rearrange them with a simple IPC script.

👉 Is there something I missed that could solve my problem? (started Hyperland just yesterday)
👉 Would you accept such a feature request? I can contribute code with a few pointers.

Thanks!

@vaxerski
Copy link
Member

I've tried to make persistent workspaces before but the workspace protocol really didnt like it, I might try in the future again.

Please remember that in those issues you linked, there is a solution that will work, so technically this is not a necessity.

@Diaoul
Copy link
Author

Diaoul commented Sep 11, 2022

Thanks for the quick answer! I did not know it was a limitation on the workspace protocol, where can I read more about Hyperland's internals?

I am currently working on a variation of this script to take into account plugging/unplugging monitors and redirecting the workspace to the right monitor. I'll post this here once I have finished 👍

@vaxerski
Copy link
Member

it's not a limitation - it's some annoying thing I was prolly doing wrong. The protocol doesnt disallow this

@vaxerski
Copy link
Member

vaxerski commented Sep 11, 2022

where can I read more about Hyperland's internals?

/src

@Diaoul
Copy link
Author

Diaoul commented Sep 11, 2022

Created a gist that does the job more or less.
There is some flickering:

  • The workspace is created on the active monitor
  • It is then moved to the correct one
  • The "leaving" animation triggers on the first monitor as if the workspace was there to begin with, and moved to another monitor -- could be a bug 🐛 here as the leaving animation does not seem to take into account the right "starting point"

The workaround in #349 works but requires static monitor configuration as far as I understand. Reminder below:

# focus
bind=SUPER,1,focusmonitor,DP-2
bind=SUPER,1,workspace,1

# move
bind=SUPERSHIFT,1,movetoworkspace,1
bind=SUPERSHIFT,1,movecurrentworkspacetomonitor,DP-2

@vaxerski
Copy link
Member

added wsbind in 0062281, partially solves this issue. See the wiki entry for its usage.

@Diaoul
Copy link
Author

Diaoul commented Sep 12, 2022

Wow that is awesome 🎉

  • What is the behavior when said monitor is not connected? Does it fallback on another monitor?
  • Would it be possible to reload another Hyprland configuration on monitor plug/unplug? I'm thinking disabling the autoreload, change the config symlink in an udev rule or something and trigger a reload with hyprctl

@vaxerski
Copy link
Member

Wow that is awesome

no, it's Hyprland

What is the behavior when said monitor is not connected? Does it fallback on another monitor?

behaves as if the wsbind wasnt there

Would it be possible to reload another Hyprland configuration on monitor plug/unplug? I'm thinking disabling the autoreload, change the config symlink in an udev rule or something and trigger a reload with hyprctl

hyprctl reload
misc:disable_autoreload

read the wiki

@anstadnik
Copy link

Hi, wsbind is amazing!
Can you add a possibility to bind "all other" workspaces? I have

wsbind=1,eDP-1
wsbind=3,DP-5

, and would like all other workspaces to open only on the 3rd monitor. Now I guess I'd have to list all of them individually

@ElJeffe
Copy link
Contributor

ElJeffe commented Nov 9, 2022

I had the same need, and created a script to do this. It will get the monitors, order them from left to right, top to bottom, and then it binds and moves the workspaces to the requested monitors.
Left: workspace 1-5 | Right: workspace 6-10
or
Left: 1-3 | Middle: 4-7 | Right: 8-10 (untested)
By detecting the position of the monitors, you do not need to hardcode their IDs.

hyprmonitor.txt
(It should obviously be a .py file but that is not accepted by github)

@vaxerski
Copy link
Member

I will close this. wsbind exists. Workspaces are destroyed - but that's how it will be. It should be up to your bar to display persistent workspaces if you really need em. See e.g. Alexays/Waybar#1629

@Diaoul
Copy link
Author

Diaoul commented Apr 23, 2023

Reviving this now that Waybar has support for persistent workspaces 🤩 👏

Has anyone success with a multi monitor setup? I face many issues on my side and I wonder if it's my particular configuration or bugs:

  • Selecting a workspace sometimes focuses the wrong workspace e.g. selecting workspace 3 makes workspace 7 active (I can create windows there). I could sometimes even select an invisible workspace and create windows there (as per the logs)
  • Swipe does not stop on the edges of a monitor e.g. swiping from workspace 3 (on monitor A) to 4 (on monitor B)
  • Cycling behavior is not intuitive to configure e.g. cycle only on the workspaces on the monitor. Although for this one it may be scriptable
  • Monitor names can change, sometimes making the configuration obsolete if that happens

I created a gist to arrange workspaces on monitors dynamically, I'll plug that into an event listener on the IPC when I can get it to work 😬

Help appreciated 🙏

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

No branches or pull requests

4 participants