diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-18 18:17:04 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-18 19:32:03 +0400 |
| commit | df9d721f7462a7edaacb9de4530580a68ab6e8ab (patch) | |
| tree | 1ed2c1a905253bba7f49d433592e1ebf4be4193d /src/niri.rs | |
| parent | d970abead82abab8ac2596662bc4d8e41a53e003 (diff) | |
| download | niri-df9d721f7462a7edaacb9de4530580a68ab6e8ab.tar.gz niri-df9d721f7462a7edaacb9de4530580a68ab6e8ab.tar.bz2 niri-df9d721f7462a7edaacb9de4530580a68ab6e8ab.zip | |
Implement focus-follows-mouse
Diffstat (limited to 'src/niri.rs')
| -rw-r--r-- | src/niri.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/niri.rs b/src/niri.rs index ef369e35..f63f05a3 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -3305,6 +3305,28 @@ impl Niri { warn!("error spawning a thread to send MonitorsChanged: {err:?}"); } } + + pub fn handle_focus_follows_mouse(&mut self, new_focus: &PointerFocus) { + if !self.config.borrow().input.focus_follows_mouse { + return; + } + + if self.seat.get_pointer().unwrap().is_grabbed() { + return; + } + + if let Some(output) = &new_focus.output { + if self.pointer_focus.output.as_ref() != Some(output) { + self.layout.focus_output(output); + } + } + + if let Some(window) = &new_focus.window { + if self.pointer_focus.window.as_ref() != Some(window) { + self.layout.activate_window(window); + } + } + } } pub struct ClientState { |
