diff options
Diffstat (limited to 'sway/commands/bar/strip_workspace_numbers.c')
-rw-r--r-- | sway/commands/bar/strip_workspace_numbers.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/commands/bar/strip_workspace_numbers.c b/sway/commands/bar/strip_workspace_numbers.c new file mode 100644 index 00000000..7a709e4b --- /dev/null +++ b/sway/commands/bar/strip_workspace_numbers.c | |||
@@ -0,0 +1,26 @@ | |||
1 | #include <string.h> | ||
2 | #include "commands.h" | ||
3 | #include "log.h" | ||
4 | |||
5 | struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { | ||
6 | struct cmd_results *error = NULL; | ||
7 | if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { | ||
8 | return error; | ||
9 | } | ||
10 | |||
11 | if (!config->current_bar) { | ||
12 | return cmd_results_new(CMD_FAILURE, "strip_workspace_numbers", "No bar defined."); | ||
13 | } | ||
14 | |||
15 | if (strcasecmp("yes", argv[0]) == 0) { | ||
16 | config->current_bar->strip_workspace_numbers = true; | ||
17 | sway_log(L_DEBUG, "Stripping workspace numbers on bar: %s", config->current_bar->id); | ||
18 | } else if (strcasecmp("no", argv[0]) == 0) { | ||
19 | config->current_bar->strip_workspace_numbers = false; | ||
20 | sway_log(L_DEBUG, "Enabling workspace numbers on bar: %s", config->current_bar->id); | ||
21 | } else { | ||
22 | error = cmd_results_new(CMD_INVALID, "strip_workspace_numbers", "Invalid value %s", argv[0]); | ||
23 | return error; | ||
24 | } | ||
25 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
26 | } | ||