zakk4223 / hyprWorkspaceLayouts

BSD 3-Clause "New" or "Revised" License
26 stars 3 forks source link

Window moving between multiple monitors with keybinds #11

Open VirtCode opened 1 month ago

VirtCode commented 1 month ago

I recently started using my keyboard for window management more often, and noticed that moving the windows with the movewindow dispatcher between monitors with different layouts seems to be broken.

This is how you can reproduce it:

Here's a video of it:

https://github.com/zakk4223/hyprWorkspaceLayouts/assets/41426325/10fb1793-cfa8-4f35-b69c-089fe8c95007

(it looks like my OBS config is a bit messed up, so sorry for the poor resolution haha, but I think it still illustrates the point)

I also had a quick peek at the code and fixing it doesn't seem as straight forward. I presume that this window moving is handled by moveWindowTo, but this implementation seems to be very layout specific (at least on dwindle and master).

I guess we could do something similar how it is done in the master layout, using getWindowInDirection and see whether that window is on another layout, and based on that swap the window (which is implemented as of recently). But that would probably not be ideal in some edge cases, also when considering supporting 3rd party layouts.

Let me know what you think about this, I would also be willing to try implementing some approach you deem good enough.

zakk4223 commented 1 month ago

You wouldn't swap, you'd just remove+add.

There's a code path in the dispatcher function that I think is never hit, which does the remove+add. It's supposed to handle window_direction_monitor_fallback but it looks like the function in the Compositor already does, so it always does layout->moveWindowTo. And Dwindle doesn't even honor that config value.

I think it's as simple as a windowRemove -> windowAdd but I"ll see if any extra tracking has to be done