diff options
author | 2017-06-14 18:53:32 -0400 | |
---|---|---|
committer | 2017-06-14 18:53:32 -0400 | |
commit | eb6e38c86d2deb37cc6f378f8644c4a530fd7448 (patch) | |
tree | e3c567c4684faf0f9a7f77494f1bf638171d5349 /swaybar/ipc.c | |
parent | Merge pull request #1236 from ykrivopalov/fix_complex_status_command (diff) | |
parent | Merge branch 'master' into tray (diff) | |
download | sway-eb6e38c86d2deb37cc6f378f8644c4a530fd7448.tar.gz sway-eb6e38c86d2deb37cc6f378f8644c4a530fd7448.tar.zst sway-eb6e38c86d2deb37cc6f378f8644c4a530fd7448.zip |
Implement Tray Icons
Diffstat (limited to 'swaybar/ipc.c')
-rw-r--r-- | swaybar/ipc.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index b08eeea8..93d1219c 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c | |||
@@ -19,11 +19,19 @@ void ipc_send_workspace_command(const char *workspace_name) { | |||
19 | 19 | ||
20 | static void ipc_parse_config(struct config *config, const char *payload) { | 20 | static void ipc_parse_config(struct config *config, const char *payload) { |
21 | json_object *bar_config = json_tokener_parse(payload); | 21 | json_object *bar_config = json_tokener_parse(payload); |
22 | json_object *tray_output, *mode, *hidden_bar, *position, *status_command; | 22 | json_object *markup, *mode, *hidden_bar, *position, *status_command; |
23 | json_object *font, *bar_height, *wrap_scroll, *workspace_buttons, *strip_workspace_numbers; | 23 | json_object *font, *bar_height, *wrap_scroll, *workspace_buttons, *strip_workspace_numbers; |
24 | json_object *binding_mode_indicator, *verbose, *colors, *sep_symbol, *outputs; | 24 | json_object *binding_mode_indicator, *verbose, *colors, *sep_symbol, *outputs; |
25 | json_object *markup; | 25 | #ifdef ENABLE_TRAY |
26 | json_object *tray_output, *icon_theme, *tray_padding, *activate_button, *context_button; | ||
27 | json_object *secondary_button; | ||
26 | json_object_object_get_ex(bar_config, "tray_output", &tray_output); | 28 | json_object_object_get_ex(bar_config, "tray_output", &tray_output); |
29 | json_object_object_get_ex(bar_config, "icon_theme", &icon_theme); | ||
30 | json_object_object_get_ex(bar_config, "tray_padding", &tray_padding); | ||
31 | json_object_object_get_ex(bar_config, "activate_button", &activate_button); | ||
32 | json_object_object_get_ex(bar_config, "context_button", &context_button); | ||
33 | json_object_object_get_ex(bar_config, "secondary_button", &secondary_button); | ||
34 | #endif | ||
27 | json_object_object_get_ex(bar_config, "mode", &mode); | 35 | json_object_object_get_ex(bar_config, "mode", &mode); |
28 | json_object_object_get_ex(bar_config, "hidden_bar", &hidden_bar); | 36 | json_object_object_get_ex(bar_config, "hidden_bar", &hidden_bar); |
29 | json_object_object_get_ex(bar_config, "position", &position); | 37 | json_object_object_get_ex(bar_config, "position", &position); |
@@ -83,6 +91,34 @@ static void ipc_parse_config(struct config *config, const char *payload) { | |||
83 | config->pango_markup = json_object_get_boolean(markup); | 91 | config->pango_markup = json_object_get_boolean(markup); |
84 | } | 92 | } |
85 | 93 | ||
94 | #ifdef ENABLE_TRAY | ||
95 | if (tray_output) { | ||
96 | free(config->tray_output); | ||
97 | config->tray_output = strdup(json_object_get_string(tray_output)); | ||
98 | } | ||
99 | |||
100 | if (icon_theme) { | ||
101 | free(config->icon_theme); | ||
102 | config->icon_theme = strdup(json_object_get_string(icon_theme)); | ||
103 | } | ||
104 | |||
105 | if (tray_padding) { | ||
106 | config->tray_padding = json_object_get_int(tray_padding); | ||
107 | } | ||
108 | |||
109 | if (activate_button) { | ||
110 | config->activate_button = json_object_get_int(activate_button); | ||
111 | } | ||
112 | |||
113 | if (context_button) { | ||
114 | config->context_button = json_object_get_int(context_button); | ||
115 | } | ||
116 | |||
117 | if (secondary_button) { | ||
118 | config->secondary_button = json_object_get_int(secondary_button); | ||
119 | } | ||
120 | #endif | ||
121 | |||
86 | // free previous outputs list | 122 | // free previous outputs list |
87 | int i; | 123 | int i; |
88 | for (i = 0; i < config->outputs->length; ++i) { | 124 | for (i = 0; i < config->outputs->length; ++i) { |