From e1554479326b1e9bd280187f7978e3b5b5a98baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20B=C3=BCrk?= Date: Sun, 29 Mar 2015 17:29:21 +0200 Subject: [PATCH] Added assignment type 'A_NO_FOCUS' (#1416) Any assignment with type 'A_NO_FOCUS' will cause the matched window to not be focused by i3 when it is managed. --- include/data.h | 4 +++- src/manage.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/data.h b/include/data.h index d40ed292..50e1f180 100644 --- a/include/data.h +++ b/include/data.h @@ -460,6 +460,7 @@ struct Assignment { * * A_COMMAND = run the specified command for the matching window * A_TO_WORKSPACE = assign the matching window to the specified workspace + * A_NO_FOCUS = don't focus matched window when it is managed * * While the type is a bitmask, only one value can be set at a time. It is * a bitmask to allow filtering for multiple types, for example in the @@ -469,7 +470,8 @@ struct Assignment { enum { A_ANY = 0, A_COMMAND = (1 << 0), - A_TO_WORKSPACE = (1 << 1) + A_TO_WORKSPACE = (1 << 1), + A_NO_FOCUS = (1 << 2) } type; /** the criteria to check if a window matches */ diff --git a/src/manage.c b/src/manage.c index 2b3c6743..3499963b 100644 --- a/src/manage.c +++ b/src/manage.c @@ -512,8 +512,10 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki /* Defer setting focus after the 'new' event has been sent to ensure the * proper window event sequence. */ if (set_focus && !nc->window->doesnt_accept_focus && nc->mapped) { - DLOG("Now setting focus.\n"); - con_focus(nc); + if (assignment_for(cwindow, A_NO_FOCUS) == NULL) { + DLOG("Now setting focus.\n"); + con_focus(nc); + } } tree_render();