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:
Ingo Bürk
2015-03-30 22:07:48 +02:00
parent 2759a308a2
commit 9bf161710b
6 changed files with 45 additions and 8 deletions

View File

@ -329,6 +329,23 @@ CFGFUN(force_display_urgency_hint, const long duration_ms) {
config.workspace_urgency_timer = duration_ms / 1000.0;
}
CFGFUN(focus_on_window_activation, const char *mode) {
if (strcmp(mode, "smart") == 0)
config.focus_on_window_activation = FOWA_SMART;
else if (strcmp(mode, "urgent") == 0)
config.focus_on_window_activation = FOWA_URGENT;
else if (strcmp(mode, "focus") == 0)
config.focus_on_window_activation = FOWA_FOCUS;
else if (strcmp(mode, "none") == 0)
config.focus_on_window_activation = FOWA_NONE;
else {
ELOG("Unknown focus_on_window_activation mode \"%s\", ignoring it.\n", mode);
return;
}
DLOG("Set new focus_on_window_activation mode = %i", config.focus_on_window_activation);
}
CFGFUN(workspace, const char *workspace, const char *output) {
DLOG("Assigning workspace \"%s\" to output \"%s\"\n", workspace, output);
/* Check for earlier assignments of the same workspace so that we