diff --git a/include/config_directives.h b/include/config_directives.h index 1a7a3932..a7da4914 100644 --- a/include/config_directives.h +++ b/include/config_directives.h @@ -80,6 +80,7 @@ CFGFUN(bar_verbose, const char *verbose); CFGFUN(bar_modifier, const char *modifier); CFGFUN(bar_wheel_up_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_i3bar_command, const char *i3bar_command); 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_workspace_buttons, const char *value); CFGFUN(bar_strip_workspace_numbers, const char *value); +CFGFUN(bar_start); CFGFUN(bar_finish); diff --git a/parser-specs/config.spec b/parser-specs/config.spec index b52fafc2..e0d422c8 100644 --- a/parser-specs/config.spec +++ b/parser-specs/config.spec @@ -393,7 +393,7 @@ state BARBRACE: end -> '{' - -> BAR + -> call cfg_bar_start(); BAR state BAR: end -> @@ -409,6 +409,7 @@ state BAR: 'modifier' -> BAR_MODIFIER 'wheel_up_cmd' -> BAR_WHEEL_UP_CMD 'wheel_down_cmd' -> BAR_WHEEL_DOWN_CMD + 'bindsym' -> BAR_BINDSYM 'position' -> BAR_POSITION 'output' -> BAR_OUTPUT 'tray_output' -> BAR_TRAY_OUTPUT @@ -463,6 +464,14 @@ state BAR_WHEEL_DOWN_CMD: command = string -> 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: position = 'top', 'bottom' -> call cfg_bar_position($position); BAR diff --git a/src/config_directives.c b/src/config_directives.c index 37bd0121..cf15d8d4 100644 --- a/src/config_directives.c +++ b/src/config_directives.c @@ -530,14 +530,21 @@ CFGFUN(bar_modifier, const char *modifier) { 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) { - FREE(current_bar.wheel_up_cmd); - current_bar.wheel_up_cmd = sstrdup(command); + ELOG("'wheel_up_cmd' is deprecated. Please us 'bindsym button4 %s' instead.\n", command); + bar_configure_mouse_command("button4", command); } CFGFUN(bar_wheel_down_cmd, const char *command) { - FREE(current_bar.wheel_down_cmd); - current_bar.wheel_down_cmd = sstrdup(command); + ELOG("'wheel_down_cmd' is deprecated. Please us 'bindsym button5 %s' instead.\n", 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) { @@ -611,6 +618,10 @@ CFGFUN(bar_strip_workspace_numbers, const char *value) { current_bar.strip_workspace_numbers = eval_boolstr(value); } +CFGFUN(bar_start) { + TAILQ_INIT(&(current_bar.mouse_commands)); +} + CFGFUN(bar_finish) { DLOG("\t new bar configuration finished, saving.\n"); /* Generate a unique ID for this bar if not already configured */ diff --git a/testcases/t/201-config-parser.t b/testcases/t/201-config-parser.t index de25e7ff..9dc0f840 100644 --- a/testcases/t/201-config-parser.t +++ b/testcases/t/201-config-parser.t @@ -689,7 +689,7 @@ EOT $expected = <<'EOT'; cfg_bar_output(LVDS-1) -ERROR: CONFIG: Expected one of these tokens: , '#', '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: , '#', '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 ) ERROR: CONFIG: Line 1: bar { ERROR: CONFIG: Line 2: output LVDS-1