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

@ -167,6 +167,18 @@ struct Config {
* flag can be delayed using an urgency timer. */
float workspace_urgency_timer;
/** Behavior when a window sends a NET_ACTIVE_WINDOW message. */
enum {
/* Focus if the target workspace is visible, set urgency hint otherwise. */
FOWA_SMART,
/* Always set the urgency hint. */
FOWA_URGENT,
/* Always focus the window. */
FOWA_FOCUS,
/* Ignore the request (no focus, no urgency hint). */
FOWA_NONE
} focus_on_window_activation;
/** The default border style for new windows. */
border_style_t default_border;

View File

@ -51,6 +51,7 @@ CFGFUN(force_focus_wrapping, const char *value);
CFGFUN(force_xinerama, const char *value);
CFGFUN(fake_outputs, const char *outputs);
CFGFUN(force_display_urgency_hint, const long duration_ms);
CFGFUN(focus_on_window_activation, const char *mode);
CFGFUN(hide_edge_borders, const char *borders);
CFGFUN(assign, const char *workspace);
CFGFUN(ipc_socket, const char *path);