diff --git a/docs/wiki/Configuration:-Recent-Windows.md b/docs/wiki/Configuration:-Recent-Windows.md index 162abf2b22..833bef4dac 100644 --- a/docs/wiki/Configuration:-Recent-Windows.md +++ b/docs/wiki/Configuration:-Recent-Windows.md @@ -36,6 +36,8 @@ recent-windows { Mod+grave { next-window filter="app-id"; } Mod+Shift+grave { previous-window filter="app-id"; } } + + // disable-mouse } ``` @@ -191,3 +193,10 @@ For example, if you have ModShiftC bound to `cl This way we don't need to hardcode things like HJKL directional movements. If you have, say, Colemak-DH MNEI binds instead, they will work for you in the window switcher (as long as they don't conflict with the hardcoded ones). + +### disable-mouse + +Since: next release + +This setting lets you disable your mouse from interacting with the window switcher. +This option might be useful if you have a graphic tablet, and the pointer messes with the switcher diff --git a/niri-config/src/recent_windows.rs b/niri-config/src/recent_windows.rs index 46e10f4c96..0ef9d81215 100644 --- a/niri-config/src/recent_windows.rs +++ b/niri-config/src/recent_windows.rs @@ -14,6 +14,7 @@ pub struct RecentWindows { pub highlight: MruHighlight, pub previews: MruPreviews, pub binds: Vec, + pub enable_mouse: bool, } impl Default for RecentWindows { @@ -25,6 +26,7 @@ impl Default for RecentWindows { highlight: MruHighlight::default(), previews: MruPreviews::default(), binds: default_binds(), + enable_mouse: true } } } @@ -45,6 +47,10 @@ pub struct RecentWindowsPart { pub previews: Option, #[knuffel(child)] pub binds: Option, + #[knuffel(child)] + pub enable_mouse: bool, + #[knuffel(child)] + pub disable_mouse: bool, } impl MergeWith for RecentWindows { @@ -53,6 +59,10 @@ impl MergeWith for RecentWindows { if part.off { self.on = false; } + self.enable_mouse |= part.enable_mouse; + if part.disable_mouse { + self.enable_mouse = false; + } merge_clone!((self, part), debounce_ms, open_delay_ms); merge!((self, part), highlight, previews); diff --git a/src/ui/mru.rs b/src/ui/mru.rs index d8ec6de16e..a2c8ee864e 100644 --- a/src/ui/mru.rs +++ b/src/ui/mru.rs @@ -1028,6 +1028,11 @@ impl WindowMruUi { let UiState::Open(inner) = &mut self.state else { return None; }; + + if !inner.config.borrow().recent_windows.enable_mouse{ + return None; + } + // Don't handle pointer until the UI is visible. if !inner.is_fully_open() { return None;