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