diff options
| author | Annika Hannig <annika@hannig.cc> | 2025-03-02 12:09:44 +0100 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-03-10 23:17:36 -0700 |
| commit | 8737067af530c95ff8039685b236b1f31297b699 (patch) | |
| tree | eaf811d84c737bbb548eac9fc535ccc9d102f2e1 /src | |
| parent | 50a99f635648c9de0d63d59dc5b7ea8d92cbe1fa (diff) | |
| download | niri-8737067af530c95ff8039685b236b1f31297b699.tar.gz niri-8737067af530c95ff8039685b236b1f31297b699.tar.bz2 niri-8737067af530c95ff8039685b236b1f31297b699.zip | |
added move window to monitor by id
Diffstat (limited to 'src')
| -rw-r--r-- | src/input/mod.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs index 4dce9376..2eba3225 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1458,6 +1458,32 @@ impl State { } } } + Action::MoveWindowToMonitorById { id, output } => { + if let Some(output) = self.niri.output_by_name_match(&output).cloned() { + let window = self.niri.layout.windows().find(|(_, m)| m.id().get() == id); + let window = window.map(|(_, m)| m.window.clone()); + + if let Some(window) = window { + let target_was_active = self + .niri + .layout + .active_output() + .is_some_and(|active| output == *active); + + self.niri + .layout + .move_to_output(Some(&window), &output, None); + + // If the active output changed (window was moved and focused). + #[allow(clippy::collapsible_if)] + if !target_was_active && self.niri.layout.active_output() == Some(&output) { + if !self.maybe_warp_cursor_to_focus_centered() { + self.move_cursor_to_output(&output); + } + } + } + } + } Action::MoveColumnToMonitorLeft => { if let Some(output) = self.niri.output_left() { self.niri.layout.move_column_to_output(&output); |
