From 495d772a38d1f22ec6d3960c4c1103d6678c4009 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Thu, 16 Nov 2023 12:00:27 -0500 Subject: [PATCH] fix: set the workspace of the activated token's surface to urgent if not focusing it --- src/wayland/handlers/xdg_activation.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/wayland/handlers/xdg_activation.rs b/src/wayland/handlers/xdg_activation.rs index 88736021..c0f895e0 100644 --- a/src/wayland/handlers/xdg_activation.rs +++ b/src/wayland/handlers/xdg_activation.rs @@ -117,11 +117,12 @@ impl XdgActivationHandler for State { let current_output = seat.active_output(); let current_workspace = self.common.shell.active_space_mut(¤t_output); - if current_workspace + let in_current_workspace = current_workspace .floating_layer .mapped() - .any(|m| m == &element) - { + .any(|m| m == &element); + + if in_current_workspace { current_workspace .floating_layer .space @@ -143,11 +144,14 @@ impl XdgActivationHandler for State { } let target = element.into(); - if workspace == ¤t_workspace.handle { + if workspace == ¤t_workspace.handle && in_current_workspace { Shell::set_focus(self, Some(&target), &seat, None); - } else { + } else if let Some((w, _)) = target + .toplevel() + .and_then(|t| self.common.shell.workspace_for_surface(&t)) + { Shell::append_focus_stack(self, Some(&target), &seat); - self.common.shell.set_urgent(workspace); + self.common.shell.set_urgent(&w); } } }