diff options
author | Mikkel Oscar Lyderik <[email protected]> | 2015-12-16 12:58:45 +0100 |
---|---|---|
committer | Mikkel Oscar Lyderik <[email protected]> | 2015-12-16 13:01:11 +0100 |
commit | 2fd7dd64ec8449f3a0e2ce9d445273b6f78a9dea (patch) | |
tree | 587a3da93a034f194355cba7b68ae7acd87ed9f4 /sway/commands.c | |
parent | 1825cf32bf45f32b5291ed42606d6911b10f72cc (diff) |
Implement bar option: separator_symbol
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index f90a5ae9..4e9630ef 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -76,6 +76,7 @@ static sway_cmd bar_cmd_height; static sway_cmd bar_cmd_hidden_state; static sway_cmd bar_cmd_id; static sway_cmd bar_cmd_position; +static sway_cmd bar_cmd_separator_symbol; static sway_cmd bar_cmd_status_command; static sway_cmd bar_cmd_strip_workspace_numbers; static sway_cmd bar_cmd_tray_output; @@ -1840,6 +1841,23 @@ static struct cmd_results *bar_cmd_position(int argc, char **argv) { return cmd_results_new(CMD_SUCCESS, NULL, NULL); } +static struct cmd_results *bar_cmd_separator_symbol(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "separator_symbol", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + if (!config->current_bar) { + return cmd_results_new(CMD_FAILURE, "separator_symbol", "No bar defined."); + } + + free(config->current_bar->separator_symbol); + config->current_bar->separator_symbol = strdup(argv[0]); + sway_log(L_DEBUG, "Settings separator_symbol '%s' for bar: %s", config->current_bar->separator_symbol, config->current_bar->id); + + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} + static struct cmd_results *bar_cmd_status_command(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "status_command", EXPECTED_AT_LEAST, 1))) { @@ -1945,7 +1963,7 @@ static struct cmd_handler bar_handlers[] = { { "modifier", bar_cmd_modifier }, { "output", bar_cmd_output }, { "position", bar_cmd_position }, - { "seperator_symbol", NULL }, + { "separator_symbol", bar_cmd_separator_symbol }, { "status_command", bar_cmd_status_command }, { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers }, { "tray_output", bar_cmd_tray_output }, |