diff options
Diffstat (limited to 'sway/old/commands/bar/position.c')
-rw-r--r-- | sway/old/commands/bar/position.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sway/old/commands/bar/position.c b/sway/old/commands/bar/position.c new file mode 100644 index 00000000..50de58e2 --- /dev/null +++ b/sway/old/commands/bar/position.c | |||
@@ -0,0 +1,33 @@ | |||
1 | #include <string.h> | ||
2 | #include <strings.h> | ||
3 | #include "sway/commands.h" | ||
4 | #include "log.h" | ||
5 | |||
6 | struct cmd_results *bar_cmd_position(int argc, char **argv) { | ||
7 | struct cmd_results *error = NULL; | ||
8 | if ((error = checkarg(argc, "position", EXPECTED_EQUAL_TO, 1))) { | ||
9 | return error; | ||
10 | } | ||
11 | |||
12 | if (!config->current_bar) { | ||
13 | return cmd_results_new(CMD_FAILURE, "position", "No bar defined."); | ||
14 | } | ||
15 | |||
16 | if (strcasecmp("top", argv[0]) == 0) { | ||
17 | config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_TOP; | ||
18 | } else if (strcasecmp("bottom", argv[0]) == 0) { | ||
19 | config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; | ||
20 | } else if (strcasecmp("left", argv[0]) == 0) { | ||
21 | sway_log(L_INFO, "Warning: swaybar currently only supports top and bottom positioning. YMMV"); | ||
22 | config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_LEFT; | ||
23 | } else if (strcasecmp("right", argv[0]) == 0) { | ||
24 | sway_log(L_INFO, "Warning: swaybar currently only supports top and bottom positioning. YMMV"); | ||
25 | config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_RIGHT; | ||
26 | } else { | ||
27 | error = cmd_results_new(CMD_INVALID, "position", "Invalid value %s", argv[0]); | ||
28 | return error; | ||
29 | } | ||
30 | |||
31 | sway_log(L_DEBUG, "Setting bar position '%s' for bar: %s", argv[0], config->current_bar->id); | ||
32 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
33 | } | ||