From 9d67ae2202840bdb52766701844b9d2dd23002f5 Mon Sep 17 00:00:00 2001 From: Peter Bui Date: Fri, 14 Oct 2011 11:36:32 -0400 Subject: [PATCH] Focus new window only if it is on a visible workspace on the current focused output. --- src/manage.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/manage.c b/src/manage.c index 22c2814f..ec9e7173 100644 --- a/src/manage.c +++ b/src/manage.c @@ -283,9 +283,13 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki if (fs == NULL) { DLOG("Not in fullscreen mode, focusing\n"); if (!cwindow->dock) { - /* Check that the workspace is visible. If the window was assigned - * to an invisible workspace, we should not steal focus. */ - if (workspace_is_visible(ws)) { + /* Check that the workspace is visible and on the same output as + * the current focused container. If the window was assigned to an + * invisible workspace, we should not steal focus. */ + Con *current_output = con_get_output(focused); + Con *target_output = con_get_output(ws); + + if (workspace_is_visible(ws) && current_output == target_output) { con_focus(nc); } else DLOG("workspace not visible, not focusing\n"); } else DLOG("dock, not focusing\n"); -- 2.39.5