Added config directive 'no_focus <criteria>' (#1416)
This commit is contained in:
parent
e155447932
commit
b5f7c132fc
|
@ -55,6 +55,7 @@ CFGFUN(focus_on_window_activation, const char *mode);
|
|||
CFGFUN(show_marks, const char *value);
|
||||
CFGFUN(hide_edge_borders, const char *borders);
|
||||
CFGFUN(assign, const char *workspace);
|
||||
CFGFUN(no_focus);
|
||||
CFGFUN(ipc_socket, const char *path);
|
||||
CFGFUN(restart_state, const char *path);
|
||||
CFGFUN(popup_during_fullscreen, const char *value);
|
||||
|
|
|
@ -31,6 +31,7 @@ state INITIAL:
|
|||
'hide_edge_borders' -> HIDE_EDGE_BORDERS
|
||||
'for_window' -> FOR_WINDOW
|
||||
'assign' -> ASSIGN
|
||||
'no_focus' -> NO_FOCUS
|
||||
'focus_follows_mouse' -> FOCUS_FOLLOWS_MOUSE
|
||||
'mouse_warping' -> MOUSE_WARPING
|
||||
'force_focus_wrapping' -> FORCE_FOCUS_WRAPPING
|
||||
|
@ -150,6 +151,15 @@ state ASSIGN_WORKSPACE:
|
|||
workspace = string
|
||||
-> call cfg_assign($workspace)
|
||||
|
||||
# no_focus <criteria>
|
||||
state NO_FOCUS:
|
||||
'['
|
||||
-> call cfg_criteria_init(NO_FOCUS_END); CRITERIA
|
||||
|
||||
state NO_FOCUS_END:
|
||||
end
|
||||
-> call cfg_no_focus()
|
||||
|
||||
# Criteria: Used by for_window and assign.
|
||||
state CRITERIA:
|
||||
ctype = 'class' -> CRITERION
|
||||
|
|
|
@ -431,6 +431,19 @@ CFGFUN(assign, const char *workspace) {
|
|||
TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
|
||||
}
|
||||
|
||||
CFGFUN(no_focus) {
|
||||
if (match_is_empty(current_match)) {
|
||||
ELOG("Match is empty, ignoring this assignment\n");
|
||||
return;
|
||||
}
|
||||
|
||||
DLOG("new assignment, using above criteria, to ignore focus on manage");
|
||||
Assignment *assignment = scalloc(sizeof(Assignment));
|
||||
match_copy(&(assignment->match), current_match);
|
||||
assignment->type = A_NO_FOCUS;
|
||||
TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Bar configuration (i3bar)
|
||||
******************************************************************************/
|
||||
|
|
|
@ -433,7 +433,7 @@ client.focused #4c7899 #285577 #ffffff #2e9ef4
|
|||
EOT
|
||||
|
||||
my $expected_all_tokens = <<'EOT';
|
||||
ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'mouse_warping', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'focus_on_window_activation', 'show_marks', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent', 'client.placeholder'
|
||||
ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'no_focus', 'focus_follows_mouse', 'mouse_warping', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'focus_on_window_activation', 'show_marks', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent', 'client.placeholder'
|
||||
EOT
|
||||
|
||||
my $expected_end = <<'EOT';
|
||||
|
|
Loading…
Reference in New Issue