Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Add an option to disable wrapping for movefocus

Open T2hhbmEK opened this issue 2 years ago • 1 comments

There's a focus_wrapping option in sway config.

  • The default option is focus_wrapping=yes, which behaves the same as Hyprland.
  • Set focus_wrapping=no will disable move to left when current focused window is already the most left window. Likewise for other directions.

Here's the doc for this option in man 5 sway.

focus_wrapping yes|no|force|workspace This option determines what to do when attempting to focus over the edge of a container. If set to no, the focused container will retain focus, if there are no other containers in the direction. If set to yes, focus will be wrapped to the opposite edge of the container, if there are no other containers in the direction. If set to force, focus will be wrapped to the opposite edge of the container, even if there are other containers in the direction. If set to workspace, focus will wrap like in the yes case and additionally wrap when moving outside of workspaces boundaries. Default is yes.

Hope for a similar config option for Hyprland.

I also found that movewindow does not wrap in Hyprland. It would be more consistent to have same behavior for both movewindow and movefocus

T2hhbmEK avatar Jan 03 '23 12:01 T2hhbmEK

After digging into src/managers/KeybindManager.cpp, it seems weird to move focus to getNextWindowOnWorkspace if no getWindowInDirection matched.

https://github.com/hyprwm/Hyprland/blob/3d1b255199db3ce9539befcd8547331b312a34e7/src/managers/KeybindManager.cpp#L1084

getNextWindowOnWorkspace sort windows by ID. And those IDs seems not to be changed if windows are moved around. Resulting in messing focus movements if no window matches in target direction and windows are already moved around.

Also, The behavior here has nothing to do with focus_wrapping. Maybe its better to just remove the alternative getNextWindowOnWorkspace movement besides getWindowInDirection.

T2hhbmEK avatar Jan 03 '23 13:01 T2hhbmEK

is this implemented with no_focus_fallback?

MightyPlaza avatar Aug 06 '23 02:08 MightyPlaza

is this implemented with no_focus_fallback?

@MightyPlaza Not yet. movefocus still wraps.

T2hhbmEK avatar Aug 07 '23 01:08 T2hhbmEK

wdym? works for me or I am misunderstanding the only thing missing is a var to enable movewindow fallback

MightyPlaza avatar Aug 07 '23 01:08 MightyPlaza

@MightyPlaza How sway behaves follows. And it's what I mean here.

wrapping (|x| means focused window, -> means movefocus right once)

| |x| | -> | | |x| -> |x| | |

no wrapping (do not movefocus again if already focusing the last window)

| |x| | -> | | |x| -> | | |x|

Similar rules should apply to movewindow.

T2hhbmEK avatar Aug 07 '23 01:08 T2hhbmEK

@MightyPlaza My bad. Typos. I retried no_focus_fallback, and it's working now. This issue can be closed.

T2hhbmEK avatar Aug 07 '23 01:08 T2hhbmEK