Dynamic workspace windowrule

Hyprland version
Hyprland 0.49.0 built from branch  at commit 9958d297641b5c84dcff93f9039d80a5ad37ab00  (version: bump to 0.49.0).
Date: Thu May 8 20:15:18 2025
Tag: v0.49.0, commits: 6098
built against:
 aquamarine 0.8.0
 hyprlang 0.6.3
 hyprutils 0.8.0
 hyprcursor 0.1.12
 hyprgraphics 0.1.4


no flags were set

One beneficial thing I often do for productivity is move my Librewolf tab groups to different desktops. 1 has general, 2 has art, 3 has design related, special has youtube and music, etc. Since Simple Tab Groups has an option to prepend the group name to the title of the window, I tried using regex to match certain groups and move them to desktops on creation. However, because of the way in which Librewolf creates new windows, the initialClass and initialTitle don’t reflect which group is open in a window, only the class and title, which can’t be used with the workspace windowrule.

Effectively, (and I sadly lack the experience to know what roadblocks this might face or how hard it would be to implement) I think it’d be beneficial to have a dynamic method of moving windows to workspaces, rather than static, as manually moving 4+ browser windows, while possible, is disruptive.

I apologize if there is some way of doing this that I’m not aware of, and I’ll be grateful for any attention this receives. Thanks!

This is something that does pop up within users from time to time - and it’s ultimately a browser bug in a sense.

What you can do to fix it, is write a script that listens to the title / class changed event in socket2, see windowtitlev2, and then just takes the window ID to send it to your desired workspace once.

hyprctl dispatch movetoworkspace 4,address:0x... will do it.

I’d probably keep track of windows you’ve moved already, because that’s the reason workspace is not dynamic. Imagine this:

  • You open a window with a title that matches a rule workspace 2.
  • Window is opened on workspace 2. Great!
  • You move it manually to workspace 3 for a moment, as you want to do (something)
  • It instantly jumps back to workspace 2 - its move to another workspace triggers dynamic rules to recalculate, as those rules can also work based on the workspace the window is on.
  • Even if the above was to not be true, the smallest change of the title would have to send it back to 2, which would make no sense to the user.

So yeah, socket2 + hyprctl is your real solution.

2 Likes

Ahhh gotcha! Thanks. I forget how much scripting can expand hyprland’s features, since it already includes so much as it is! The logic behind the static effect is sound: that sounds like hell lol.

1 Like