Added 'focus_on_window_activation' directive
When a window receives a _NET_ACTIVE_WINDOW message, it can steal the focus. This may not be preferable to all users. With this directive, the user can choose from one of the following: 1) 'smart' - focus the container if its workspace is visible, otherwise set the urgency flag (default) 2) 'urgent' - always set the urgency flag, do not steal focus 3) 'focus' - always switch focus, never set the urgency hint 4) 'none' - ignore the request entirely (do not switch focus, nor set the urgency hint) fixes #1426
This commit is contained in:
@ -743,16 +743,17 @@ static void handle_client_message(xcb_client_message_event_t *event) {
|
||||
workspace_show(ws);
|
||||
con_focus(con);
|
||||
} else {
|
||||
/* If the request is from an application, only focus if the
|
||||
* workspace is visible. Otherwise set the urgency hint. */
|
||||
if (workspace_is_visible(ws)) {
|
||||
DLOG("Request to focus con on a visible workspace. Focusing con = %p\n", con);
|
||||
/* Request is from an application. */
|
||||
|
||||
if (config.focus_on_window_activation == FOWA_FOCUS || (config.focus_on_window_activation == FOWA_SMART && workspace_is_visible(ws))) {
|
||||
DLOG("Focusing con = %p\n", con);
|
||||
workspace_show(ws);
|
||||
con_focus(con);
|
||||
} else {
|
||||
DLOG("Request to focus con on a hidden workspace. Setting urgent con = %p\n", con);
|
||||
} else if (config.focus_on_window_activation == FOWA_URGENT || (config.focus_on_window_activation == FOWA_SMART && !workspace_is_visible(ws))) {
|
||||
DLOG("Marking con = %p urgent\n", con);
|
||||
con_set_urgency(con, true);
|
||||
}
|
||||
} else
|
||||
DLOG("Ignoring request for con = %p", con);
|
||||
}
|
||||
|
||||
tree_render();
|
||||
|
Reference in New Issue
Block a user