Warp mouse to focus on new window appearing
Browse files at this commita011b385d87db2eb8ecbff2ca2bfb7862e8267dfParent: 29847221 changed file +7 -0
src/handlers/compositor.rsmodified+7 -0
| @@ -143,6 +143,7 @@ impl CompositorHandler for State { | |||
| 143 | }) | 143 | }) |
| 144 | .map(|(window, _)| window.clone()); | 144 | .map(|(window, _)| window.clone()); |
| 145 | 145 | ||
| 146 | + let window = window.clone(); | ||
| 146 | let win = window.clone(); | 147 | let win = window.clone(); |
| 147 | 148 | ||
| 148 | let output = if let Some(p) = parent { | 149 | let output = if let Some(p) = parent { |
| @@ -161,6 +162,12 @@ impl CompositorHandler for State { | |||
| 161 | 162 | ||
| 162 | if let Some(output) = output.cloned() { | 163 | if let Some(output) = output.cloned() { |
| 163 | self.niri.layout.start_open_animation_for_window(&window); | 164 | self.niri.layout.start_open_animation_for_window(&window); |
| 165 | + | ||
| 166 | + let new_active_window = self.niri.layout.active_window().map(|(w, _)| w); | ||
| 167 | + if new_active_window == Some(&window) { | ||
| 168 | + self.maybe_warp_cursor_to_focus(); | ||
| 169 | + } | ||
| 170 | + | ||
| 164 | self.niri.queue_redraw(output); | 171 | self.niri.queue_redraw(output); |
| 165 | } | 172 | } |
| 166 | return; | 173 | return; |