YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
2.82k stars 79 forks source link

feat: add `focus-column-or-monitor-left`, `focus-column-or-monitor-right` #456

Closed lpnh closed 1 week ago

lpnh commented 2 weeks ago

Partially addresses: https://github.com/YaLTeR/niri/discussions/296

This is a preliminary sketch for implementing focus-column-or-monitor-left and focus-column-or-monitor-right, which expand the default left and and right focus behaviors. If a window is available in the target direction, it receives focus; otherwise, the focus shifts to the corresponding monitor.

Current state: it kinda works, but there are cases that still need to be fixed. I will try to provide a better description soon.

To be completely honest, I'm new to the Niri codebase, so there's a lot I'm still unsure about. I was hoping to provide a good starting point for this PR, but it seems like I still have a lot to learn.

Any feedback would be greatly appreciated.

lpnh commented 1 week ago

Well, it seems both focus-window-or-monitor-left and focus-window-or-monitor-right are now working as expected.

A couple of things about the implementation:

maybe_focus_window_or_monitor_*

FocusWindowOrMonitor*

Now, about the test... I'm not quite sure how to write it properly. I attempted to provide some, but I am unsure if they make any sense.

This was very fun, so I wouldn't mind rewriting anything you think could be improved. Also, feel free to take it from here.

lpnh commented 1 week ago

Wait, I just realized. Could you rename Window to Column throughout? Left-Right focus goes by columns, not by windows, and other actions are also focus-column-left, etc.

Sure! I had the same thought initially. We might have been influenced by the initial request. Thanks for catching this.

lpnh commented 1 week ago

May I move them next to the other Column variables?

YaLTeR commented 1 week ago

Yeah

YaLTeR commented 1 week ago

Thanks!