diff options
author | 2016-11-03 08:32:10 -0600 | |
---|---|---|
committer | 2016-11-03 08:32:10 -0600 | |
commit | e9ac0492b7ec55d34d9209f2ff3e08de5c014d65 (patch) | |
tree | ee822e5e219275c84446709c349de630d7441055 /swaybar/ipc.c | |
parent | Log LD_LIBRARY_PATH (diff) | |
parent | swap unnecessary function for strndup (diff) | |
download | sway-e9ac0492b7ec55d34d9209f2ff3e08de5c014d65.tar.gz sway-e9ac0492b7ec55d34d9209f2ff3e08de5c014d65.tar.zst sway-e9ac0492b7ec55d34d9209f2ff3e08de5c014d65.zip |
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) { | |||
108 | 108 | ||
109 | if (colors) { | 109 | if (colors) { |
110 | json_object *background, *statusline, *separator; | 110 | json_object *background, *statusline, *separator; |
111 | json_object *focused_background, *focused_statusline, *focused_separator; | ||
111 | json_object *focused_workspace_border, *focused_workspace_bg, *focused_workspace_text; | 112 | json_object *focused_workspace_border, *focused_workspace_bg, *focused_workspace_text; |
112 | json_object *inactive_workspace_border, *inactive_workspace_bg, *inactive_workspace_text; | 113 | json_object *inactive_workspace_border, *inactive_workspace_bg, *inactive_workspace_text; |
113 | json_object *active_workspace_border, *active_workspace_bg, *active_workspace_text; | 114 | 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) { | |||
116 | json_object_object_get_ex(colors, "background", &background); | 117 | json_object_object_get_ex(colors, "background", &background); |
117 | json_object_object_get_ex(colors, "statusline", &statusline); | 118 | json_object_object_get_ex(colors, "statusline", &statusline); |
118 | json_object_object_get_ex(colors, "separator", &separator); | 119 | json_object_object_get_ex(colors, "separator", &separator); |
120 | json_object_object_get_ex(colors, "focused_background", &focused_background); | ||
121 | json_object_object_get_ex(colors, "focused_statusline", &focused_statusline); | ||
122 | json_object_object_get_ex(colors, "focused_separator", &focused_separator); | ||
119 | json_object_object_get_ex(colors, "focused_workspace_border", &focused_workspace_border); | 123 | json_object_object_get_ex(colors, "focused_workspace_border", &focused_workspace_border); |
120 | json_object_object_get_ex(colors, "focused_workspace_bg", &focused_workspace_bg); | 124 | json_object_object_get_ex(colors, "focused_workspace_bg", &focused_workspace_bg); |
121 | json_object_object_get_ex(colors, "focused_workspace_text", &focused_workspace_text); | 125 | 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) { | |||
143 | config->colors.separator = parse_color(json_object_get_string(separator)); | 147 | config->colors.separator = parse_color(json_object_get_string(separator)); |
144 | } | 148 | } |
145 | 149 | ||
150 | if (focused_background) { | ||
151 | config->colors.focused_background = parse_color(json_object_get_string(focused_background)); | ||
152 | } | ||
153 | |||
154 | if (focused_statusline) { | ||
155 | config->colors.focused_statusline = parse_color(json_object_get_string(focused_statusline)); | ||
156 | } | ||
157 | |||
158 | if (focused_separator) { | ||
159 | config->colors.focused_separator = parse_color(json_object_get_string(focused_separator)); | ||
160 | } | ||
161 | |||
146 | if (focused_workspace_border) { | 162 | if (focused_workspace_border) { |
147 | config->colors.focused_workspace.border = parse_color(json_object_get_string(focused_workspace_border)); | 163 | config->colors.focused_workspace.border = parse_color(json_object_get_string(focused_workspace_border)); |
148 | } | 164 | } |
@@ -235,6 +251,13 @@ static void ipc_update_workspaces(struct bar *bar) { | |||
235 | ws->name = strdup(json_object_get_string(name)); | 251 | ws->name = strdup(json_object_get_string(name)); |
236 | ws->visible = json_object_get_boolean(visible); | 252 | ws->visible = json_object_get_boolean(visible); |
237 | ws->focused = json_object_get_boolean(focused); | 253 | ws->focused = json_object_get_boolean(focused); |
254 | if (ws->focused) { | ||
255 | if (bar->focused_output) { | ||
256 | bar->focused_output->focused = false; | ||
257 | } | ||
258 | bar->focused_output = output; | ||
259 | output->focused = true; | ||
260 | } | ||
238 | ws->urgent = json_object_get_boolean(urgent); | 261 | ws->urgent = json_object_get_boolean(urgent); |
239 | list_add(output->workspaces, ws); | 262 | list_add(output->workspaces, ws); |
240 | } | 263 | } |