Add new command skeleton 'bindsym <button> <command>' for 'bar' block.

This commit is contained in:
Ingo Bürk 2015-05-02 21:53:23 +02:00
parent 1d4b5863a5
commit ab12d3fc74
4 changed files with 28 additions and 6 deletions

View File

@ -80,6 +80,7 @@ CFGFUN(bar_verbose, const char *verbose);
CFGFUN(bar_modifier, const char *modifier); CFGFUN(bar_modifier, const char *modifier);
CFGFUN(bar_wheel_up_cmd, const char *command); CFGFUN(bar_wheel_up_cmd, const char *command);
CFGFUN(bar_wheel_down_cmd, const char *command); CFGFUN(bar_wheel_down_cmd, const char *command);
CFGFUN(bar_bindsym, const char *button, const char *command);
CFGFUN(bar_position, const char *position); CFGFUN(bar_position, const char *position);
CFGFUN(bar_i3bar_command, const char *i3bar_command); CFGFUN(bar_i3bar_command, const char *i3bar_command);
CFGFUN(bar_color, const char *colorclass, const char *border, const char *background, const char *text); CFGFUN(bar_color, const char *colorclass, const char *border, const char *background, const char *text);
@ -90,4 +91,5 @@ CFGFUN(bar_status_command, const char *command);
CFGFUN(bar_binding_mode_indicator, const char *value); CFGFUN(bar_binding_mode_indicator, const char *value);
CFGFUN(bar_workspace_buttons, const char *value); CFGFUN(bar_workspace_buttons, const char *value);
CFGFUN(bar_strip_workspace_numbers, const char *value); CFGFUN(bar_strip_workspace_numbers, const char *value);
CFGFUN(bar_start);
CFGFUN(bar_finish); CFGFUN(bar_finish);

View File

@ -393,7 +393,7 @@ state BARBRACE:
end end
-> ->
'{' '{'
-> BAR -> call cfg_bar_start(); BAR
state BAR: state BAR:
end -> end ->
@ -409,6 +409,7 @@ state BAR:
'modifier' -> BAR_MODIFIER 'modifier' -> BAR_MODIFIER
'wheel_up_cmd' -> BAR_WHEEL_UP_CMD 'wheel_up_cmd' -> BAR_WHEEL_UP_CMD
'wheel_down_cmd' -> BAR_WHEEL_DOWN_CMD 'wheel_down_cmd' -> BAR_WHEEL_DOWN_CMD
'bindsym' -> BAR_BINDSYM
'position' -> BAR_POSITION 'position' -> BAR_POSITION
'output' -> BAR_OUTPUT 'output' -> BAR_OUTPUT
'tray_output' -> BAR_TRAY_OUTPUT 'tray_output' -> BAR_TRAY_OUTPUT
@ -463,6 +464,14 @@ state BAR_WHEEL_DOWN_CMD:
command = string command = string
-> call cfg_bar_wheel_down_cmd($command); BAR -> call cfg_bar_wheel_down_cmd($command); BAR
state BAR_BINDSYM:
button = word
-> BAR_BINDSYM_COMMAND
state BAR_BINDSYM_COMMAND:
command = string
-> call cfg_bar_bindsym($button, $command); BAR
state BAR_POSITION: state BAR_POSITION:
position = 'top', 'bottom' position = 'top', 'bottom'
-> call cfg_bar_position($position); BAR -> call cfg_bar_position($position); BAR

View File

@ -530,14 +530,21 @@ CFGFUN(bar_modifier, const char *modifier) {
current_bar.modifier = M_SHIFT; current_bar.modifier = M_SHIFT;
} }
static void bar_configure_mouse_command(const char *button, const char *command) {
}
CFGFUN(bar_wheel_up_cmd, const char *command) { CFGFUN(bar_wheel_up_cmd, const char *command) {
FREE(current_bar.wheel_up_cmd); ELOG("'wheel_up_cmd' is deprecated. Please us 'bindsym button4 %s' instead.\n", command);
current_bar.wheel_up_cmd = sstrdup(command); bar_configure_mouse_command("button4", command);
} }
CFGFUN(bar_wheel_down_cmd, const char *command) { CFGFUN(bar_wheel_down_cmd, const char *command) {
FREE(current_bar.wheel_down_cmd); ELOG("'wheel_down_cmd' is deprecated. Please us 'bindsym button5 %s' instead.\n", command);
current_bar.wheel_down_cmd = sstrdup(command); bar_configure_mouse_command("button5", command);
}
CFGFUN(bar_bindsym, const char *button, const char *command) {
bar_configure_mouse_command(button, command);
} }
CFGFUN(bar_position, const char *position) { CFGFUN(bar_position, const char *position) {
@ -611,6 +618,10 @@ CFGFUN(bar_strip_workspace_numbers, const char *value) {
current_bar.strip_workspace_numbers = eval_boolstr(value); current_bar.strip_workspace_numbers = eval_boolstr(value);
} }
CFGFUN(bar_start) {
TAILQ_INIT(&(current_bar.mouse_commands));
}
CFGFUN(bar_finish) { CFGFUN(bar_finish) {
DLOG("\t new bar configuration finished, saving.\n"); DLOG("\t new bar configuration finished, saving.\n");
/* Generate a unique ID for this bar if not already configured */ /* Generate a unique ID for this bar if not already configured */

View File

@ -689,7 +689,7 @@ EOT
$expected = <<'EOT'; $expected = <<'EOT';
cfg_bar_output(LVDS-1) cfg_bar_output(LVDS-1)
ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'i3bar_command', 'status_command', 'socket_path', 'mode', 'hidden_state', 'id', 'modifier', 'wheel_up_cmd', 'wheel_down_cmd', 'position', 'output', 'tray_output', 'font', 'separator_symbol', 'binding_mode_indicator', 'workspace_buttons', 'strip_workspace_numbers', 'verbose', 'colors', '}' ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'i3bar_command', 'status_command', 'socket_path', 'mode', 'hidden_state', 'id', 'modifier', 'wheel_up_cmd', 'wheel_down_cmd', 'bindsym', 'position', 'output', 'tray_output', 'font', 'separator_symbol', 'binding_mode_indicator', 'workspace_buttons', 'strip_workspace_numbers', 'verbose', 'colors', '}'
ERROR: CONFIG: (in file <stdin>) ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: bar { ERROR: CONFIG: Line 1: bar {
ERROR: CONFIG: Line 2: output LVDS-1 ERROR: CONFIG: Line 2: output LVDS-1