diff options
author | Connor E <38229097+c-edw@users.noreply.github.com> | 2018-11-17 16:11:28 +0000 |
---|---|---|
committer | Connor E <38229097+c-edw@users.noreply.github.com> | 2018-11-17 16:11:28 +0000 |
commit | 4bd46fb079fb5a32ee6eb2b297de273b261a9c71 (patch) | |
tree | 81dfd95a863ae17de78a6c69a14dd5698c6de862 /sway/commands/bar/strip_workspace_name.c | |
parent | Merge pull request #3046 from tokyovigilante/relative-transform (diff) | |
download | sway-4bd46fb079fb5a32ee6eb2b297de273b261a9c71.tar.gz sway-4bd46fb079fb5a32ee6eb2b297de273b261a9c71.tar.zst sway-4bd46fb079fb5a32ee6eb2b297de273b261a9c71.zip |
Implement strip_workspace_name.
Diffstat (limited to 'sway/commands/bar/strip_workspace_name.c')
-rw-r--r-- | sway/commands/bar/strip_workspace_name.c | 32 |
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 | |||
7 | struct 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 | } | ||