aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/bar/icon_theme.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/bar/icon_theme.c')
-rw-r--r--sway/commands/bar/icon_theme.c25
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 @@
+#define _POSIX_C_SOURCE 200809L
#include <string.h>
+#include "config.h"
#include "sway/commands.h"
+#include "sway/config.h"
+#include "log.h"
struct cmd_results *bar_cmd_icon_theme(int argc, char **argv) {
- // TODO TRAY
- return cmd_results_new(CMD_INVALID, "icon_theme", "TODO TRAY");
+#if HAVE_TRAY
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "icon_theme", EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+
+ if (!config->current_bar) {
+ return cmd_results_new(CMD_FAILURE, "tray_padding", "No bar defined.");
+ }
+
+ wlr_log(WLR_DEBUG, "[Bar %s] Setting icon theme to %s",
+ config->current_bar->id, argv[0]);
+ free(config->current_bar->icon_theme);
+ config->current_bar->icon_theme = strdup(argv[0]);
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+#else
+ return cmd_results_new(CMD_INVALID, "icon_theme",
+ "Sway has been compiled without tray support");
+#endif
}