diff options
| author | Illia Ostapyshyn <ilya.ostapyshyn@gmail.com> | 2025-06-11 08:28:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-11 06:28:03 +0000 |
| commit | 10a6d6ae45d246287b6d00231545ba8c5c1ba594 (patch) | |
| tree | d25fc64a30deeaf985270cd077e85a49aeda3fd5 /src | |
| parent | 7db864d203220437dc75ed8bd5606f785f853c93 (diff) | |
| download | niri-10a6d6ae45d246287b6d00231545ba8c5c1ba594.tar.gz niri-10a6d6ae45d246287b6d00231545ba8c5c1ba594.tar.bz2 niri-10a6d6ae45d246287b6d00231545ba8c5c1ba594.zip | |
Expand screenshot UI to handle move-X-or-to-workspace/monitor-X (#1669)
* Expand screenshot UI to handle more moving actions
Currently, screenshot UI handles MoveColumn{Left,Right} and
MoveWindow{Up,Down} which move the screenshot selection as if it were a
floating window. Expand this to include MoveColumn*OrToMonitor* and
MoveWindow*OrToWorkspace* and adjust their logic to move the screenshot
selection.
* Update src/input/mod.rs
---------
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/input/mod.rs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs index fc011b6a..6a7e8a71 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -774,7 +774,9 @@ impl State { self.niri.queue_redraw_all(); } Action::MoveColumnLeftOrToMonitorLeft => { - if let Some(output) = self.niri.output_left() { + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.move_left(); + } else if let Some(output) = self.niri.output_left() { if self.niri.layout.move_column_left_or_to_output(&output) && !self.maybe_warp_cursor_to_focus_centered() { @@ -791,7 +793,9 @@ impl State { self.niri.queue_redraw_all(); } Action::MoveColumnRightOrToMonitorRight => { - if let Some(output) = self.niri.output_right() { + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.move_right(); + } else if let Some(output) = self.niri.output_right() { if self.niri.layout.move_column_right_or_to_output(&output) && !self.maybe_warp_cursor_to_focus_centered() { @@ -830,14 +834,22 @@ impl State { self.niri.queue_redraw_all(); } Action::MoveWindowDownOrToWorkspaceDown => { - self.niri.layout.move_down_or_to_workspace_down(); - self.maybe_warp_cursor_to_focus(); + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.move_down(); + } else { + self.niri.layout.move_down_or_to_workspace_down(); + self.maybe_warp_cursor_to_focus(); + } // FIXME: granular self.niri.queue_redraw_all(); } Action::MoveWindowUpOrToWorkspaceUp => { - self.niri.layout.move_up_or_to_workspace_up(); - self.maybe_warp_cursor_to_focus(); + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.move_up(); + } else { + self.niri.layout.move_up_or_to_workspace_up(); + self.maybe_warp_cursor_to_focus(); + } // FIXME: granular self.niri.queue_redraw_all(); } @@ -4101,9 +4113,13 @@ fn allowed_during_screenshot(action: &Action) -> bool { | Action::PowerOnMonitors // The screenshot UI can handle these. | Action::MoveColumnLeft + | Action::MoveColumnLeftOrToMonitorLeft | Action::MoveColumnRight + | Action::MoveColumnRightOrToMonitorRight | Action::MoveWindowUp + | Action::MoveWindowUpOrToWorkspaceUp | Action::MoveWindowDown + | Action::MoveWindowDownOrToWorkspaceDown | Action::SetWindowWidth(_) | Action::SetWindowHeight(_) | Action::SetColumnWidth(_) |
