diff options
| author | nyx <nnyyxxxx@protonmail.com> | 2025-03-29 03:40:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-29 07:40:21 +0000 |
| commit | 7dc015e16b30be457a227601de85f085e5af1dda (patch) | |
| tree | 061bcf50826d4ad03f6f7b16535d6e2ea94655de /src/input/mod.rs | |
| parent | 0db48e2f1bf001bfd05c686002ff1998d0f1205b (diff) | |
| download | niri-7dc015e16b30be457a227601de85f085e5af1dda.tar.gz niri-7dc015e16b30be457a227601de85f085e5af1dda.tar.bz2 niri-7dc015e16b30be457a227601de85f085e5af1dda.zip | |
screenshot: make selection area modifiable via move/resize keybinds (#1279)
* screenshot: make selection area modifiable via keybinds
* input: run fmt
* Reimplement screenshot UI binds in a better way
---------
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'src/input/mod.rs')
| -rw-r--r-- | src/input/mod.rs | 71 |
1 files changed, 60 insertions, 11 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs index 961df54a..c6b5441a 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -740,14 +740,24 @@ impl State { }); } Action::MoveColumnLeft => { - self.niri.layout.move_left(); - self.maybe_warp_cursor_to_focus(); + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.move_left(); + } else { + self.niri.layout.move_left(); + self.maybe_warp_cursor_to_focus(); + } + // FIXME: granular self.niri.queue_redraw_all(); } Action::MoveColumnRight => { - self.niri.layout.move_right(); - self.maybe_warp_cursor_to_focus(); + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.move_right(); + } else { + self.niri.layout.move_right(); + self.maybe_warp_cursor_to_focus(); + } + // FIXME: granular self.niri.queue_redraw_all(); } @@ -798,14 +808,24 @@ impl State { self.niri.queue_redraw_all(); } Action::MoveWindowDown => { - self.niri.layout.move_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(); + self.maybe_warp_cursor_to_focus(); + } + // FIXME: granular self.niri.queue_redraw_all(); } Action::MoveWindowUp => { - self.niri.layout.move_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(); + self.maybe_warp_cursor_to_focus(); + } + // FIXME: granular self.niri.queue_redraw_all(); } @@ -1589,10 +1609,24 @@ impl State { } } Action::SetColumnWidth(change) => { - self.niri.layout.set_column_width(change); + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.set_width(change); + + // FIXME: granular + self.niri.queue_redraw_all(); + } else { + self.niri.layout.set_column_width(change); + } } Action::SetWindowWidth(change) => { - self.niri.layout.set_window_width(None, change); + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.set_width(change); + + // FIXME: granular + self.niri.queue_redraw_all(); + } else { + self.niri.layout.set_window_width(None, change); + } } Action::SetWindowWidthById { id, change } => { let window = self.niri.layout.windows().find(|(_, m)| m.id().get() == id); @@ -1602,7 +1636,14 @@ impl State { } } Action::SetWindowHeight(change) => { - self.niri.layout.set_window_height(None, change); + if self.niri.screenshot_ui.is_open() { + self.niri.screenshot_ui.set_height(change); + + // FIXME: granular + self.niri.queue_redraw_all(); + } else { + self.niri.layout.set_window_height(None, change); + } } Action::SetWindowHeightById { id, change } => { let window = self.niri.layout.windows().find(|(_, m)| m.id().get() == id); @@ -3418,6 +3459,14 @@ fn allowed_during_screenshot(action: &Action) -> bool { | Action::Suspend | Action::PowerOffMonitors | Action::PowerOnMonitors + // The screenshot UI can handle these. + | Action::MoveColumnLeft + | Action::MoveColumnRight + | Action::MoveWindowUp + | Action::MoveWindowDown + | Action::SetWindowWidth(_) + | Action::SetWindowHeight(_) + | Action::SetColumnWidth(_) ) } |
