From 7829e7696d276c0b51ea4834986a0a37e40b9ee4 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Thu, 5 Dec 2024 18:31:34 +0100 Subject: [PATCH] focus: Only consider focused output --- src/shell/focus/mod.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/shell/focus/mod.rs b/src/shell/focus/mod.rs index 6ab2e857..638ac4ec 100644 --- a/src/shell/focus/mod.rs +++ b/src/shell/focus/mod.rs @@ -172,7 +172,7 @@ impl Shell { let focused_windows = self .seats .iter() - .flat_map(|seat| { + .map(|seat| { if matches!( seat.get_keyboard().unwrap().current_focus(), Some(KeyboardFocusTarget::Group(_)) @@ -180,11 +180,10 @@ impl Shell { return None; } - Some(self.outputs().flat_map(|o| { - let space = self.active_space(o); - let stack = space.focus_stack.get(seat); - stack.last().cloned() - })) + let output = seat.focused_or_active_output(); + let space = self.active_space(&output); + let stack = space.focus_stack.get(seat); + stack.last().cloned() }) .flatten() .collect::>(); @@ -223,7 +222,7 @@ impl Shell { for window in workspace.mapped() { window.set_activated(false); window.configure(); - } + } } } }