zakk4223/hyprWorkspaceLayouts

Window moving between multiple monitors with keybinds

Opened this issue · 1 comments

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:

  • Two monitors next to each other with different layouts (left dwindle, right master)
  • When moving a window from the master to the dwindle monitor with movewindow, l, the window is not tiled correctly.
  • This window is broken and mainly inaccessible.
  • When killing the window from a terminal, Hyprland crashes.

Here's a video of it:

2024-06-27.13-55-46.mp4

(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.

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