aboutsummaryrefslogtreecommitdiff
path: root/swaybar/ipc.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-06-14 18:53:32 -0400
committerGitHub <noreply@github.com>2017-06-14 18:53:32 -0400
commiteb6e38c86d2deb37cc6f378f8644c4a530fd7448 (patch)
treee3c567c4684faf0f9a7f77494f1bf638171d5349 /swaybar/ipc.c
parent16e20ec251b027c5a8dbc5e85804012f2602629d (diff)
parent0fc9628f03984caa04e200a1dc458d1cf7fc6d6c (diff)
Merge pull request #1234 from 4e554c4c/tray
Implement Tray Icons
Diffstat (limited to 'swaybar/ipc.c')
-rw-r--r--swaybar/ipc.c40
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) {
static void ipc_parse_config(struct config *config, const char *payload) {
json_object *bar_config = json_tokener_parse(payload);
- json_object *tray_output, *mode, *hidden_bar, *position, *status_command;
+ json_object *markup, *mode, *hidden_bar, *position, *status_command;
json_object *font, *bar_height, *wrap_scroll, *workspace_buttons, *strip_workspace_numbers;
json_object *binding_mode_indicator, *verbose, *colors, *sep_symbol, *outputs;
- json_object *markup;
+#ifdef ENABLE_TRAY
+ json_object *tray_output, *icon_theme, *tray_padding, *activate_button, *context_button;
+ json_object *secondary_button;
json_object_object_get_ex(bar_config, "tray_output", &tray_output);
+ json_object_object_get_ex(bar_config, "icon_theme", &icon_theme);
+ json_object_object_get_ex(bar_config, "tray_padding", &tray_padding);
+ json_object_object_get_ex(bar_config, "activate_button", &activate_button);
+ json_object_object_get_ex(bar_config, "context_button", &context_button);
+ json_object_object_get_ex(bar_config, "secondary_button", &secondary_button);
+#endif
json_object_object_get_ex(bar_config, "mode", &mode);
json_object_object_get_ex(bar_config, "hidden_bar", &hidden_bar);
json_object_object_get_ex(bar_config, "position", &position);
@@ -83,6 +91,34 @@ static void ipc_parse_config(struct config *config, const char *payload) {
config->pango_markup = json_object_get_boolean(markup);
}
+#ifdef ENABLE_TRAY
+ if (tray_output) {
+ free(config->tray_output);
+ config->tray_output = strdup(json_object_get_string(tray_output));
+ }
+
+ if (icon_theme) {
+ free(config->icon_theme);
+ config->icon_theme = strdup(json_object_get_string(icon_theme));
+ }
+
+ if (tray_padding) {
+ config->tray_padding = json_object_get_int(tray_padding);
+ }
+
+ if (activate_button) {
+ config->activate_button = json_object_get_int(activate_button);
+ }
+
+ if (context_button) {
+ config->context_button = json_object_get_int(context_button);
+ }
+
+ if (secondary_button) {
+ config->secondary_button = json_object_get_int(secondary_button);
+ }
+#endif
+
// free previous outputs list
int i;
for (i = 0; i < config->outputs->length; ++i) {