aboutsummaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorrustn00b <83183600+rustn00b@users.noreply.github.com>2025-01-09 08:29:36 +0000
committerGitHub <noreply@github.com>2025-01-09 08:29:36 +0000
commit80815a1591aa3362a5e1c095e9ab81b2945041a7 (patch)
treea09a434ff35efc61e1596a34d7d90ba5f69f4111 /src/input
parent8412bfb8136544549e3174fd48859d0be0090c78 (diff)
downloadniri-80815a1591aa3362a5e1c095e9ab81b2945041a7.tar.gz
niri-80815a1591aa3362a5e1c095e9ab81b2945041a7.tar.bz2
niri-80815a1591aa3362a5e1c095e9ab81b2945041a7.zip
Add a window swap operation (#899)
Swap the active window with the a neighboring column's active window. --------- Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com> Take into account PR comments - no longer behave like an expel when a swap is made in a direction where there is no column to swap with - fix janky animation
Diffstat (limited to 'src/input')
-rw-r--r--src/input/mod.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 263f533d..576bc2f5 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -36,6 +36,7 @@ use touch_move_grab::TouchMoveGrab;
use self::move_grab::MoveGrab;
use self::resize_grab::ResizeGrab;
use self::spatial_movement_grab::SpatialMovementGrab;
+use crate::layout::scrolling::ScrollDirection;
use crate::niri::State;
use crate::ui::screenshot_ui::ScreenshotUi;
use crate::utils::spawning::spawn;
@@ -1132,6 +1133,22 @@ impl State {
// FIXME: granular
self.niri.queue_redraw_all();
}
+ Action::SwapWindowRight => {
+ self.niri
+ .layout
+ .swap_window_in_direction(ScrollDirection::Right);
+ self.maybe_warp_cursor_to_focus();
+ // FIXME: granular
+ self.niri.queue_redraw_all();
+ }
+ Action::SwapWindowLeft => {
+ self.niri
+ .layout
+ .swap_window_in_direction(ScrollDirection::Left);
+ self.maybe_warp_cursor_to_focus();
+ // FIXME: granular
+ self.niri.queue_redraw_all();
+ }
Action::SwitchPresetColumnWidth => {
self.niri.layout.toggle_width();
}