diff --git a/src/shell/focus/mod.rs b/src/shell/focus/mod.rs index 582a9c81..299cb4f5 100644 --- a/src/shell/focus/mod.rs +++ b/src/shell/focus/mod.rs @@ -1,5 +1,5 @@ use crate::{ - shell::{CosmicSurface, MinimizedWindow, Shell, element::CosmicMapped}, + shell::{CosmicSurface, MinimizedWindow, Shell, Trigger, element::CosmicMapped}, state::Common, utils::prelude::*, wayland::handlers::{xdg_shell::PopupGrabData, xwayland_keyboard_grab::XWaylandGrabSeatData}, @@ -680,17 +680,23 @@ fn update_focus_target( .cloned() .map(KeyboardFocusTarget::from) } else { - shell - .active_space(output) - .unwrap() + let workspace = shell.active_space(output).unwrap(); + + if let Some(Trigger::KeyboardSwap(_, desc)) = shell.overview_mode().0.active_trigger() { + if workspace.handle == desc.handle && workspace.tiling_layer.has_node(&desc.node) { + if let Some(focus) = workspace.tiling_layer.node_desc_to_focus(desc) { + return Some(focus); + } + } + } + + workspace .focus_stack .get(seat) .last() .cloned() .map(Into::::into) .or_else(|| { - let workspace = shell.active_space(output).unwrap(); - workspace .mapped() .next()