diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-11-03 08:32:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 08:32:10 -0600 |
commit | e9ac0492b7ec55d34d9209f2ff3e08de5c014d65 (patch) | |
tree | ee822e5e219275c84446709c349de630d7441055 /swaybar/ipc.c | |
parent | d3e55f88ecaacf7c7017357e83f30f91ffc02bb0 (diff) | |
parent | 3d1b472b8312ec212b82b9a5c34af40272e9d995 (diff) | |
download | sway-e9ac0492b7ec55d34d9209f2ff3e08de5c014d65.tar.xz |
Merge pull request #965 from thejan2009/swaybar-colours
Fix some colour settings in swaybar
Diffstat (limited to 'swaybar/ipc.c')
-rw-r--r-- | swaybar/ipc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 2c092853..8d2f4e9a 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -108,6 +108,7 @@ static void ipc_parse_config(struct config *config, const char *payload) { if (colors) { json_object *background, *statusline, *separator; + json_object *focused_background, *focused_statusline, *focused_separator; json_object *focused_workspace_border, *focused_workspace_bg, *focused_workspace_text; json_object *inactive_workspace_border, *inactive_workspace_bg, *inactive_workspace_text; json_object *active_workspace_border, *active_workspace_bg, *active_workspace_text; @@ -116,6 +117,9 @@ static void ipc_parse_config(struct config *config, const char *payload) { json_object_object_get_ex(colors, "background", &background); json_object_object_get_ex(colors, "statusline", &statusline); json_object_object_get_ex(colors, "separator", &separator); + json_object_object_get_ex(colors, "focused_background", &focused_background); + json_object_object_get_ex(colors, "focused_statusline", &focused_statusline); + json_object_object_get_ex(colors, "focused_separator", &focused_separator); json_object_object_get_ex(colors, "focused_workspace_border", &focused_workspace_border); json_object_object_get_ex(colors, "focused_workspace_bg", &focused_workspace_bg); json_object_object_get_ex(colors, "focused_workspace_text", &focused_workspace_text); @@ -143,6 +147,18 @@ static void ipc_parse_config(struct config *config, const char *payload) { config->colors.separator = parse_color(json_object_get_string(separator)); } + if (focused_background) { + config->colors.focused_background = parse_color(json_object_get_string(focused_background)); + } + + if (focused_statusline) { + config->colors.focused_statusline = parse_color(json_object_get_string(focused_statusline)); + } + + if (focused_separator) { + config->colors.focused_separator = parse_color(json_object_get_string(focused_separator)); + } + if (focused_workspace_border) { config->colors.focused_workspace.border = parse_color(json_object_get_string(focused_workspace_border)); } @@ -235,6 +251,13 @@ static void ipc_update_workspaces(struct bar *bar) { ws->name = strdup(json_object_get_string(name)); ws->visible = json_object_get_boolean(visible); ws->focused = json_object_get_boolean(focused); + if (ws->focused) { + if (bar->focused_output) { + bar->focused_output->focused = false; + } + bar->focused_output = output; + output->focused = true; + } ws->urgent = json_object_get_boolean(urgent); list_add(output->workspaces, ws); } |