diff options
Diffstat (limited to 'swaybar/ipc.c')
-rw-r--r-- | swaybar/ipc.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 2b930786..8e7a542e 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <wlr/util/log.h> | 6 | #include <wlr/util/log.h> |
7 | #include "swaybar/config.h" | 7 | #include "swaybar/config.h" |
8 | #include "swaybar/ipc.h" | 8 | #include "swaybar/ipc.h" |
9 | #include "config.h" | ||
9 | #include "ipc-client.h" | 10 | #include "ipc-client.h" |
10 | #include "list.h" | 11 | #include "list.h" |
11 | 12 | ||
@@ -282,6 +283,40 @@ static bool ipc_parse_config( | |||
282 | ipc_parse_colors(config, colors); | 283 | ipc_parse_colors(config, colors); |
283 | } | 284 | } |
284 | 285 | ||
286 | #if HAVE_TRAY | ||
287 | json_object *tray_outputs, *tray_padding, *tray_bindings, *icon_theme; | ||
288 | |||
289 | if ((json_object_object_get_ex(bar_config, "tray_outputs", &tray_outputs))) { | ||
290 | config->tray_outputs = create_list(); | ||
291 | int length = json_object_array_length(tray_outputs); | ||
292 | for (int i = 0; i < length; ++i) { | ||
293 | json_object *o = json_object_array_get_idx(tray_outputs, i); | ||
294 | list_add(config->tray_outputs, strdup(json_object_get_string(o))); | ||
295 | } | ||
296 | config->tray_hidden = strcmp(config->tray_outputs->items[0], "none") == 0; | ||
297 | } | ||
298 | |||
299 | if ((json_object_object_get_ex(bar_config, "tray_padding", &tray_padding))) { | ||
300 | config->tray_padding = json_object_get_int(tray_padding); | ||
301 | } | ||
302 | |||
303 | if ((json_object_object_get_ex(bar_config, "tray_bindings", &tray_bindings))) { | ||
304 | int length = json_object_array_length(tray_bindings); | ||
305 | for (int i = 0; i < length; ++i) { | ||
306 | json_object *bind = json_object_array_get_idx(tray_bindings, i); | ||
307 | json_object *button, *command; | ||
308 | json_object_object_get_ex(bind, "input_code", &button); | ||
309 | json_object_object_get_ex(bind, "command", &command); | ||
310 | config->tray_bindings[json_object_get_int(button)] = | ||
311 | strdup(json_object_get_string(command)); | ||
312 | } | ||
313 | } | ||
314 | |||
315 | if ((json_object_object_get_ex(bar_config, "icon_theme", &icon_theme))) { | ||
316 | config->icon_theme = strdup(json_object_get_string(icon_theme)); | ||
317 | } | ||
318 | #endif | ||
319 | |||
285 | json_object_put(bar_config); | 320 | json_object_put(bar_config); |
286 | return true; | 321 | return true; |
287 | } | 322 | } |