diff options
Diffstat (limited to 'sway/commands/bar/icon_theme.c')
-rw-r--r-- | sway/commands/bar/icon_theme.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sway/commands/bar/icon_theme.c b/sway/commands/bar/icon_theme.c index 0e30409b..9d3b6040 100644 --- a/sway/commands/bar/icon_theme.c +++ b/sway/commands/bar/icon_theme.c | |||
@@ -1,7 +1,28 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | ||
1 | #include <string.h> | 2 | #include <string.h> |
3 | #include "config.h" | ||
2 | #include "sway/commands.h" | 4 | #include "sway/commands.h" |
5 | #include "sway/config.h" | ||
6 | #include "log.h" | ||
3 | 7 | ||
4 | struct cmd_results *bar_cmd_icon_theme(int argc, char **argv) { | 8 | struct cmd_results *bar_cmd_icon_theme(int argc, char **argv) { |
5 | // TODO TRAY | 9 | #if HAVE_TRAY |
6 | return cmd_results_new(CMD_INVALID, "icon_theme", "TODO TRAY"); | 10 | struct cmd_results *error = NULL; |
11 | if ((error = checkarg(argc, "icon_theme", EXPECTED_EQUAL_TO, 1))) { | ||
12 | return error; | ||
13 | } | ||
14 | |||
15 | if (!config->current_bar) { | ||
16 | return cmd_results_new(CMD_FAILURE, "tray_padding", "No bar defined."); | ||
17 | } | ||
18 | |||
19 | wlr_log(WLR_DEBUG, "[Bar %s] Setting icon theme to %s", | ||
20 | config->current_bar->id, argv[0]); | ||
21 | free(config->current_bar->icon_theme); | ||
22 | config->current_bar->icon_theme = strdup(argv[0]); | ||
23 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
24 | #else | ||
25 | return cmd_results_new(CMD_INVALID, "icon_theme", | ||
26 | "Sway has been compiled without tray support"); | ||
27 | #endif | ||
7 | } | 28 | } |