Warp mouse to focus on new window appearing

This commit is contained in:
Ivan Molodetskikh
2024-03-17 07:48:34 +04:00
parent 2984722f80
commit a011b385d8
+7
View File
@@ -143,6 +143,7 @@ impl CompositorHandler for State {
}) })
.map(|(window, _)| window.clone()); .map(|(window, _)| window.clone());
let window = window.clone();
let win = window.clone(); let win = window.clone();
let output = if let Some(p) = parent { let output = if let Some(p) = parent {
@@ -161,6 +162,12 @@ impl CompositorHandler for State {
if let Some(output) = output.cloned() { if let Some(output) = output.cloned() {
self.niri.layout.start_open_animation_for_window(&window); self.niri.layout.start_open_animation_for_window(&window);
let new_active_window = self.niri.layout.active_window().map(|(w, _)| w);
if new_active_window == Some(&window) {
self.maybe_warp_cursor_to_focus();
}
self.niri.queue_redraw(output); self.niri.queue_redraw(output);
} }
return; return;