focus: Restore focus to swap group

This commit is contained in:
Victoria Brekenfeld 2025-12-11 13:33:31 +01:00 • committed by Victoria Brekenfeld
parent 15b6b678c1
commit d708e18278

View file

@ -1,5 +1,5 @@
use crate::{ use crate::{
shell::{CosmicSurface, MinimizedWindow, Shell, element::CosmicMapped}, shell::{CosmicSurface, MinimizedWindow, Shell, Trigger, element::CosmicMapped},
state::Common, state::Common,
utils::prelude::*, utils::prelude::*,
wayland::handlers::{xdg_shell::PopupGrabData, xwayland_keyboard_grab::XWaylandGrabSeatData}, wayland::handlers::{xdg_shell::PopupGrabData, xwayland_keyboard_grab::XWaylandGrabSeatData},
@ -680,17 +680,23 @@ fn update_focus_target(
.cloned() .cloned()
.map(KeyboardFocusTarget::from) .map(KeyboardFocusTarget::from)
} else { } else {
shell let workspace = shell.active_space(output).unwrap();
.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 .focus_stack
.get(seat) .get(seat)
.last() .last()
.cloned() .cloned()
.map(Into::<KeyboardFocusTarget>::into) .map(Into::<KeyboardFocusTarget>::into)
.or_else(|| { .or_else(|| {
let workspace = shell.active_space(output).unwrap();
workspace workspace
.mapped() .mapped()
.next() .next()