aboutsummaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorTheAngusMcFire <43189215+TheAngusMcFire@users.noreply.github.com>2024-07-05 06:55:04 +0200
committerGitHub <noreply@github.com>2024-07-05 04:55:04 +0000
commita56e4ff436cc4f36d7cda89e985d51e37f0b4f78 (patch)
tree30b5b4b5385173c72042d64ec73660b9f85098d2 /src/input
parent9dcc9160b3b4be6c44672e8579e1e7107453c8b7 (diff)
downloadniri-a56e4ff436cc4f36d7cda89e985d51e37f0b4f78.tar.gz
niri-a56e4ff436cc4f36d7cda89e985d51e37f0b4f78.tar.bz2
niri-a56e4ff436cc4f36d7cda89e985d51e37f0b4f78.zip
Added Commnads to focus windows or Monitors above/below the active window (#497)
* Implement focus-window-up/down-or-monitor calls * Fixed wrong naming of focus-window-or-monitor commands * fix copy pase errors for focusing direction * Fixed wrong behaviour when the current workspace is empty * Cleanup navigation code to reduce complexity * Fix wrong comments and add testcases for FocusWindowOrMonitorUp/Down --------- Co-authored-by: Christian Rieger <christian.rieger@student.tugraz.at>
Diffstat (limited to 'src/input')
-rw-r--r--src/input/mod.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 5e775b03..2a1073f9 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -596,6 +596,40 @@ impl State {
// FIXME: granular
self.niri.queue_redraw_all();
}
+ Action::FocusWindowOrMonitorUp => {
+ if let Some(output) = self.niri.output_up() {
+ if self.niri.layout.focus_window_up_or_output(&output)
+ && !self.maybe_warp_cursor_to_focus_centered()
+ {
+ self.move_cursor_to_output(&output);
+ } else {
+ self.maybe_warp_cursor_to_focus();
+ }
+ } else {
+ self.niri.layout.focus_up();
+ self.maybe_warp_cursor_to_focus();
+ }
+
+ // FIXME: granular
+ self.niri.queue_redraw_all();
+ }
+ Action::FocusWindowOrMonitorDown => {
+ if let Some(output) = self.niri.output_down() {
+ if self.niri.layout.focus_window_down_or_output(&output)
+ && !self.maybe_warp_cursor_to_focus_centered()
+ {
+ self.move_cursor_to_output(&output);
+ } else {
+ self.maybe_warp_cursor_to_focus();
+ }
+ } else {
+ self.niri.layout.focus_down();
+ self.maybe_warp_cursor_to_focus();
+ }
+
+ // FIXME: granular
+ self.niri.queue_redraw_all();
+ }
Action::FocusColumnOrMonitorLeft => {
if let Some(output) = self.niri.output_left() {
if self.niri.layout.focus_column_left_or_output(&output)