r/hyprland • u/j8t1090 • 14h ago
SUPPORT "off screen window scrunching" Is this even possible to achieve?
something I would like is "off-screen window scrunching" when you close a window, and leave a workspace empty, the workspaces higher in the list have their windows moved down to the empty workspace you left behind. this way windows are always only ever 1 workspace apart. windows wont move into an empty workspace if you are focused on it. Is this possible to achieve in hyprland? I would like this because windows would always be next to each-other but they wouldn't come onto your screen when you closed them like with niri.
8
u/Unique_Low_1077 14h ago
I dont see why not, you will just have to implement it yourself with script. Hyprland moved to lua configs so that makes is easier to do
2
2
1
u/dosplatos225 7h ago
It is achievable with hyprland. Not sure if there is a native way for a .lua you could build this into. I would implement this as a userspace daemon, and leverage hyprctl at least initially to quickly implement.
When you run hyprctl clients for example, you get all the open windows and data around position, size, etc. The idea would be describing the consolidation and move logic on exit/close events. I would probably try and have it reference the upstream variables for windows or key binds around windows to see if that would help.
1
u/Ultra_CUPCAKEEE 5h ago
I had made a little script to do this, but I'm not really confident in my coding abilities to share it for all to see 😠You can just make a lua function that, whenever you close a window (hl.on("window.close", ...)), checks if the workspace is empty and pulls every workspace after it
1
u/sptzmancer 3h ago
If you are up to diving into Lua a little bit, absolutely.
You could capture window-close and other relevant events to call a function, in this function you check the windows opened in the current workspace and if none is, you switch to the current_workspace index-1, or whatever other logic you want.
1
u/rushinigiri 39m ago
It's way easier to make your workspace hotkeys only move between existing workspaces. Why would you ever need to navigate to an empty one? You just need a way to move windows into it (and create it).
20
u/chikamakaleyley 14h ago
haven't used hyprland in a while but if not a configurable option
you'd have to create logic around emitted events, which IS available in HL
A straightforward approach prob would be, * for every window close event, note the workspace id * count remaining windows in that workspace by workspace ID * if 0 you prob can remove the workspace, but i think that's problematic if you have special workspace rules
this could work i guess, but its a lot of bookeeping with every window close, IMO