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