aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bar/strip_workspace_name.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/bar/strip_workspace_name.c')
-rw-r--r--sway/commands/bar/strip_workspace_name.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sway/commands/bar/strip_workspace_name.c b/sway/commands/bar/strip_workspace_name.c
new file mode 100644
index 00000000..79692f6e
--- /dev/null
+++ b/sway/commands/bar/strip_workspace_name.c
@@ -0,0 +1,32 @@
1#include <string.h>
2#include <strings.h>
3#include "sway/commands.h"
4#include "log.h"
5#include "util.h"
6
7struct cmd_results *bar_cmd_strip_workspace_name(int argc, char **argv) {
8 struct cmd_results *error = NULL;
9 if ((error = checkarg(argc,
10 "strip_workspace_name", EXPECTED_EQUAL_TO, 1))) {
11 return error;
12 }
13 if (!config->current_bar) {
14 return cmd_results_new(CMD_FAILURE,
15 "strip_workspace_name", "No bar defined.");
16 }
17
18 config->current_bar->strip_workspace_name =
19 parse_boolean(argv[0], config->current_bar->strip_workspace_name);
20
21 if (config->current_bar->strip_workspace_name) {
22 config->current_bar->strip_workspace_numbers = false;
23
24 wlr_log(WLR_DEBUG, "Stripping workspace name on bar: %s",
25 config->current_bar->id);
26 } else {
27 wlr_log(WLR_DEBUG, "Enabling workspace name on bar: %s",
28 config->current_bar->id);
29 }
30
31 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
32}