diff options
Diffstat (limited to 'src/input/mod.rs')
| -rw-r--r-- | src/input/mod.rs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs index 95d30457..08bebe40 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -41,7 +41,7 @@ use self::resize_grab::ResizeGrab; use self::spatial_movement_grab::SpatialMovementGrab; use crate::layout::scrolling::ScrollDirection; use crate::layout::LayoutElement as _; -use crate::niri::State; +use crate::niri::{CastTarget, State}; use crate::ui::screenshot_ui::ScreenshotUi; use crate::utils::spawning::spawn; use crate::utils::{center, get_monotonic_time, ResizeEdge}; @@ -1786,6 +1786,36 @@ impl State { } } } + Action::SetDynamicCastWindow => { + let id = self + .niri + .layout + .active_workspace() + .and_then(|ws| ws.active_window()) + .map(|mapped| mapped.id().get()); + if let Some(id) = id { + self.set_dynamic_cast_target(CastTarget::Window { id }); + } + } + Action::SetDynamicCastWindowById(id) => { + let layout = &self.niri.layout; + if layout.windows().any(|(_, mapped)| mapped.id().get() == id) { + self.set_dynamic_cast_target(CastTarget::Window { id }); + } + } + Action::SetDynamicCastMonitor(output) => { + let output = match output { + None => self.niri.layout.active_output(), + Some(name) => self.niri.output_by_name_match(&name), + }; + if let Some(output) = output { + let output = output.downgrade(); + self.set_dynamic_cast_target(CastTarget::Output(output)); + } + } + Action::ClearDynamicCastTarget => { + self.set_dynamic_cast_target(CastTarget::Nothing); + } } } |
