From 9cfcff00392cbb486c852bb9c3403bc662415ed7 Mon Sep 17 00:00:00 2001 From: Tim Hallmann Date: Thu, 3 Feb 2022 19:30:44 +0100 Subject: [PATCH] input/seat: emit focus events when focusing parent Emit a focus event when a container or the entire workspace gets focused (for example, when focus_parent is called). Previously, focus events were only emitted when another view or workspace was focused. This made it impossible to accurately follow the focus by monitoring focus events. --- sway/input/seat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index ce933b66..dd18246c 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1198,8 +1198,10 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { // emit ipc events set_workspace(seat, new_workspace); - if (container && container->view) { + if (container) { ipc_event_window(container, "focus"); + } else if(last_workspace == new_workspace) { + ipc_event_workspace(NULL, new_workspace, "focus"); } // Move sticky containers to new workspace