diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 1 | ||||
-rw-r--r-- | sway/commands/bar/colors.c | 222 | ||||
-rw-r--r-- | sway/config.c | 68 | ||||
-rw-r--r-- | sway/ipc-json.c | 12 |
4 files changed, 124 insertions, 179 deletions
diff --git a/sway/commands.c b/sway/commands.c index 872e9fc3..de29a7af 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -255,6 +255,7 @@ struct cmd_results *add_color(const char *name, char *buffer, const char *color) | |||
255 | buffer[7] = 'f'; | 255 | buffer[7] = 'f'; |
256 | buffer[8] = 'f'; | 256 | buffer[8] = 'f'; |
257 | } | 257 | } |
258 | buffer[9] = '\0'; | ||
258 | 259 | ||
259 | return NULL; | 260 | return NULL; |
260 | } | 261 | } |
diff --git a/sway/commands/bar/colors.c b/sway/commands/bar/colors.c index 8fb7fe27..f6fb520a 100644 --- a/sway/commands/bar/colors.c +++ b/sway/commands/bar/colors.c | |||
@@ -1,211 +1,123 @@ | |||
1 | #include <string.h> | 1 | #include <string.h> |
2 | #include "sway/commands.h" | 2 | #include "sway/commands.h" |
3 | 3 | ||
4 | struct cmd_results *bar_cmd_colors(int argc, char **argv) { | 4 | static struct cmd_results *parse_single_color(char **color, const char *cmd_name, int argc, char **argv) { |
5 | struct cmd_results *error = NULL; | ||
6 | if ((error = checkarg(argc, "colors", EXPECTED_EQUAL_TO, 1))) { | ||
7 | return error; | ||
8 | } | ||
9 | |||
10 | if (strcmp("{", argv[0]) != 0) { | ||
11 | return cmd_results_new(CMD_INVALID, "colors", | ||
12 | "Expected '{' at the start of colors config definition."); | ||
13 | } | ||
14 | |||
15 | return cmd_results_new(CMD_BLOCK_BAR_COLORS, NULL, NULL); | ||
16 | } | ||
17 | |||
18 | struct cmd_results *bar_colors_cmd_active_workspace(int argc, char **argv) { | ||
19 | struct cmd_results *error = NULL; | 5 | struct cmd_results *error = NULL; |
20 | if ((error = checkarg(argc, "active_workspace", EXPECTED_EQUAL_TO, 3))) { | 6 | if ((error = checkarg(argc, cmd_name, EXPECTED_EQUAL_TO, 1))) { |
21 | return error; | 7 | return error; |
22 | } | 8 | } |
23 | 9 | ||
24 | if ((error = add_color("active_workspace_border", config->current_bar->colors.active_workspace_border, argv[0]))) { | 10 | if (!*color) { |
25 | return error; | 11 | *color = malloc(10); |
26 | } | 12 | } |
27 | 13 | ||
28 | if ((error = add_color("active_workspace_bg", config->current_bar->colors.active_workspace_bg, argv[1]))) { | 14 | error = add_color(cmd_name, *color, argv[0]); |
29 | return error; | 15 | if (error) { |
30 | } | ||
31 | |||
32 | if ((error = add_color("active_workspace_text", config->current_bar->colors.active_workspace_text, argv[2]))) { | ||
33 | return error; | 16 | return error; |
34 | } | 17 | } |
35 | 18 | ||
36 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 19 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
37 | } | 20 | } |
38 | 21 | ||
39 | struct cmd_results *bar_colors_cmd_background(int argc, char **argv) { | 22 | static struct cmd_results *parse_three_colors(char ***colors, const char *cmd_name, int argc, char **argv) { |
40 | struct cmd_results *error = NULL; | 23 | struct cmd_results *error = NULL; |
41 | if ((error = checkarg(argc, "background", EXPECTED_EQUAL_TO, 1))) { | 24 | if (argc != 3) { |
42 | return error; | 25 | return cmd_results_new(CMD_INVALID, cmd_name, "Requires exactly three color values"); |
43 | } | 26 | } |
44 | 27 | ||
45 | if ((error = add_color("background", config->current_bar->colors.background, argv[0]))) { | 28 | int i; |
46 | return error; | 29 | for (i = 0; i < 3; i++) { |
30 | if (!*colors[i]) { | ||
31 | *(colors[i]) = malloc(10); | ||
32 | } | ||
33 | error = add_color(cmd_name, *(colors[i]), argv[i]); | ||
34 | if (error) { | ||
35 | return error; | ||
36 | } | ||
47 | } | 37 | } |
48 | 38 | ||
49 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 39 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
50 | } | 40 | } |
51 | 41 | ||
52 | struct cmd_results *bar_colors_cmd_focused_background(int argc, char **argv) { | 42 | struct cmd_results *bar_cmd_colors(int argc, char **argv) { |
53 | struct cmd_results *error = NULL; | 43 | struct cmd_results *error = NULL; |
54 | if ((error = checkarg(argc, "focused_background", EXPECTED_EQUAL_TO, 1))) { | 44 | if ((error = checkarg(argc, "colors", EXPECTED_EQUAL_TO, 1))) { |
55 | return error; | 45 | return error; |
56 | } | 46 | } |
57 | 47 | ||
58 | if ((error = add_color("focused_background", config->current_bar->colors.focused_background, argv[0]))) { | 48 | if (strcmp("{", argv[0]) != 0) { |
59 | return error; | 49 | return cmd_results_new(CMD_INVALID, "colors", |
60 | }else { | 50 | "Expected '{' at the start of colors config definition."); |
61 | config->current_bar->colors.has_focused_background = true; | ||
62 | } | 51 | } |
63 | 52 | ||
64 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 53 | return cmd_results_new(CMD_BLOCK_BAR_COLORS, NULL, NULL); |
65 | } | 54 | } |
66 | 55 | ||
67 | struct cmd_results *bar_colors_cmd_binding_mode(int argc, char **argv) { | 56 | struct cmd_results *bar_colors_cmd_active_workspace(int argc, char **argv) { |
68 | struct cmd_results *error = NULL; | 57 | char **colors[3] = { |
69 | if ((error = checkarg(argc, "binding_mode", EXPECTED_EQUAL_TO, 3))) { | 58 | &(config->current_bar->colors.active_workspace_border), |
70 | return error; | 59 | &(config->current_bar->colors.active_workspace_bg), |
71 | } | 60 | &(config->current_bar->colors.active_workspace_text) |
72 | 61 | }; | |
73 | if ((error = add_color("binding_mode_border", config->current_bar->colors.binding_mode_border, argv[0]))) { | 62 | return parse_three_colors(colors, "active_workspace", argc, argv); |
74 | return error; | 63 | } |
75 | } else { | ||
76 | config->current_bar->colors.has_binding_mode_border = true; | ||
77 | } | ||
78 | 64 | ||
79 | if ((error = add_color("binding_mode_bg", config->current_bar->colors.binding_mode_bg, argv[1]))) { | 65 | struct cmd_results *bar_colors_cmd_background(int argc, char **argv) { |
80 | return error; | 66 | return parse_single_color(&(config->current_bar->colors.background), "background", argc, argv); |
81 | } else { | 67 | } |
82 | config->current_bar->colors.has_binding_mode_bg = true; | ||
83 | } | ||
84 | 68 | ||
85 | if ((error = add_color("binding_mode_text", config->current_bar->colors.binding_mode_text, argv[2]))) { | 69 | struct cmd_results *bar_colors_cmd_focused_background(int argc, char **argv) { |
86 | return error; | 70 | return parse_single_color(&(config->current_bar->colors.focused_background), "focused_background", argc, argv); |
87 | } else { | 71 | } |
88 | config->current_bar->colors.has_binding_mode_text = true; | ||
89 | } | ||
90 | 72 | ||
91 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 73 | struct cmd_results *bar_colors_cmd_binding_mode(int argc, char **argv) { |
74 | char **colors[3] = { | ||
75 | &(config->current_bar->colors.binding_mode_border), | ||
76 | &(config->current_bar->colors.binding_mode_bg), | ||
77 | &(config->current_bar->colors.binding_mode_text) | ||
78 | }; | ||
79 | return parse_three_colors(colors, "binding_mode", argc, argv); | ||
92 | } | 80 | } |
93 | 81 | ||
94 | struct cmd_results *bar_colors_cmd_focused_workspace(int argc, char **argv) { | 82 | struct cmd_results *bar_colors_cmd_focused_workspace(int argc, char **argv) { |
95 | struct cmd_results *error = NULL; | 83 | char **colors[3] = { |
96 | if ((error = checkarg(argc, "focused_workspace", EXPECTED_EQUAL_TO, 3))) { | 84 | &(config->current_bar->colors.focused_workspace_border), |
97 | return error; | 85 | &(config->current_bar->colors.focused_workspace_bg), |
98 | } | 86 | &(config->current_bar->colors.focused_workspace_text) |
99 | 87 | }; | |
100 | if ((error = add_color("focused_workspace_border", config->current_bar->colors.focused_workspace_border, argv[0]))) { | 88 | return parse_three_colors(colors, "focused_workspace", argc, argv); |
101 | return error; | ||
102 | } | ||
103 | |||
104 | if ((error = add_color("focused_workspace_bg", config->current_bar->colors.focused_workspace_bg, argv[1]))) { | ||
105 | return error; | ||
106 | } | ||
107 | |||
108 | if ((error = add_color("focused_workspace_text", config->current_bar->colors.focused_workspace_text, argv[2]))) { | ||
109 | return error; | ||
110 | } | ||
111 | |||
112 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
113 | } | 89 | } |
114 | 90 | ||
115 | struct cmd_results *bar_colors_cmd_inactive_workspace(int argc, char **argv) { | 91 | struct cmd_results *bar_colors_cmd_inactive_workspace(int argc, char **argv) { |
116 | struct cmd_results *error = NULL; | 92 | char **colors[3] = { |
117 | if ((error = checkarg(argc, "inactive_workspace", EXPECTED_EQUAL_TO, 3))) { | 93 | &(config->current_bar->colors.inactive_workspace_border), |
118 | return error; | 94 | &(config->current_bar->colors.inactive_workspace_bg), |
119 | } | 95 | &(config->current_bar->colors.inactive_workspace_text) |
120 | 96 | }; | |
121 | if ((error = add_color("inactive_workspace_border", config->current_bar->colors.inactive_workspace_border, argv[0]))) { | 97 | return parse_three_colors(colors, "inactive_workspace", argc, argv); |
122 | return error; | ||
123 | } | ||
124 | |||
125 | if ((error = add_color("inactive_workspace_bg", config->current_bar->colors.inactive_workspace_bg, argv[1]))) { | ||
126 | return error; | ||
127 | } | ||
128 | |||
129 | if ((error = add_color("inactive_workspace_text", config->current_bar->colors.inactive_workspace_text, argv[2]))) { | ||
130 | return error; | ||
131 | } | ||
132 | |||
133 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
134 | } | 98 | } |
135 | 99 | ||
136 | struct cmd_results *bar_colors_cmd_separator(int argc, char **argv) { | 100 | struct cmd_results *bar_colors_cmd_separator(int argc, char **argv) { |
137 | struct cmd_results *error = NULL; | 101 | return parse_single_color(&(config->current_bar->colors.separator), "separator", argc, argv); |
138 | if ((error = checkarg(argc, "separator", EXPECTED_EQUAL_TO, 1))) { | ||
139 | return error; | ||
140 | } | ||
141 | |||
142 | if ((error = add_color("separator", config->current_bar->colors.separator, argv[0]))) { | ||
143 | return error; | ||
144 | } | ||
145 | |||
146 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
147 | } | 102 | } |
148 | 103 | ||
149 | struct cmd_results *bar_colors_cmd_focused_separator(int argc, char **argv) { | 104 | struct cmd_results *bar_colors_cmd_focused_separator(int argc, char **argv) { |
150 | struct cmd_results *error = NULL; | 105 | return parse_single_color(&(config->current_bar->colors.focused_separator), "focused_separator", argc, argv); |
151 | if ((error = checkarg(argc, "focused_separator", EXPECTED_EQUAL_TO, 1))) { | ||
152 | return error; | ||
153 | } | ||
154 | |||
155 | if ((error = add_color("focused_separator", config->current_bar->colors.focused_separator, argv[0]))) { | ||
156 | return error; | ||
157 | } else { | ||
158 | config->current_bar->colors.has_focused_separator = true; | ||
159 | } | ||
160 | |||
161 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
162 | } | 106 | } |
163 | 107 | ||
164 | struct cmd_results *bar_colors_cmd_statusline(int argc, char **argv) { | 108 | struct cmd_results *bar_colors_cmd_statusline(int argc, char **argv) { |
165 | struct cmd_results *error = NULL; | 109 | return parse_single_color(&(config->current_bar->colors.statusline), "statusline", argc, argv); |
166 | if ((error = checkarg(argc, "statusline", EXPECTED_EQUAL_TO, 1))) { | ||
167 | return error; | ||
168 | } | ||
169 | |||
170 | if ((error = add_color("statusline", config->current_bar->colors.statusline, argv[0]))) { | ||
171 | return error; | ||
172 | } | ||
173 | |||
174 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
175 | } | 110 | } |
176 | 111 | ||
177 | struct cmd_results *bar_colors_cmd_focused_statusline(int argc, char **argv) { | 112 | struct cmd_results *bar_colors_cmd_focused_statusline(int argc, char **argv) { |
178 | struct cmd_results *error = NULL; | 113 | return parse_single_color(&(config->current_bar->colors.focused_separator), "focused_separator", argc, argv); |
179 | if ((error = checkarg(argc, "focused_statusline", EXPECTED_EQUAL_TO, 1))) { | ||
180 | return error; | ||
181 | } | ||
182 | |||
183 | if ((error = add_color("focused_statusline", config->current_bar->colors.focused_statusline, argv[0]))) { | ||
184 | return error; | ||
185 | } else { | ||
186 | config->current_bar->colors.has_focused_statusline = true; | ||
187 | } | ||
188 | |||
189 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
190 | } | 114 | } |
191 | 115 | ||
192 | struct cmd_results *bar_colors_cmd_urgent_workspace(int argc, char **argv) { | 116 | struct cmd_results *bar_colors_cmd_urgent_workspace(int argc, char **argv) { |
193 | struct cmd_results *error = NULL; | 117 | char **colors[3] = { |
194 | if ((error = checkarg(argc, "urgent_workspace", EXPECTED_EQUAL_TO, 3))) { | 118 | &(config->current_bar->colors.urgent_workspace_border), |
195 | return error; | 119 | &(config->current_bar->colors.urgent_workspace_bg), |
196 | } | 120 | &(config->current_bar->colors.urgent_workspace_text) |
197 | 121 | }; | |
198 | if ((error = add_color("urgent_workspace_border", config->current_bar->colors.urgent_workspace_border, argv[0]))) { | 122 | return parse_three_colors(colors, "urgent_workspace", argc, argv); |
199 | return error; | ||
200 | } | ||
201 | |||
202 | if ((error = add_color("urgent_workspace_bg", config->current_bar->colors.urgent_workspace_bg, argv[1]))) { | ||
203 | return error; | ||
204 | } | ||
205 | |||
206 | if ((error = add_color("urgent_workspace_text", config->current_bar->colors.urgent_workspace_text, argv[2]))) { | ||
207 | return error; | ||
208 | } | ||
209 | |||
210 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
211 | } | 123 | } |
diff --git a/sway/config.c b/sway/config.c index 6d4cf2ff..d790afa2 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -70,6 +70,28 @@ static void free_bar(struct bar_config *bar) { | |||
70 | terminate_swaybar(bar->pid); | 70 | terminate_swaybar(bar->pid); |
71 | } | 71 | } |
72 | 72 | ||
73 | free(bar->colors.background); | ||
74 | free(bar->colors.statusline); | ||
75 | free(bar->colors.separator); | ||
76 | free(bar->colors.focused_background); | ||
77 | free(bar->colors.focused_statusline); | ||
78 | free(bar->colors.focused_separator); | ||
79 | free(bar->colors.focused_workspace_border); | ||
80 | free(bar->colors.focused_workspace_bg); | ||
81 | free(bar->colors.focused_workspace_text); | ||
82 | free(bar->colors.active_workspace_border); | ||
83 | free(bar->colors.active_workspace_bg); | ||
84 | free(bar->colors.active_workspace_text); | ||
85 | free(bar->colors.inactive_workspace_border); | ||
86 | free(bar->colors.inactive_workspace_bg); | ||
87 | free(bar->colors.inactive_workspace_text); | ||
88 | free(bar->colors.urgent_workspace_border); | ||
89 | free(bar->colors.urgent_workspace_bg); | ||
90 | free(bar->colors.urgent_workspace_text); | ||
91 | free(bar->colors.binding_mode_border); | ||
92 | free(bar->colors.binding_mode_bg); | ||
93 | free(bar->colors.binding_mode_text); | ||
94 | |||
73 | free(bar); | 95 | free(bar); |
74 | } | 96 | } |
75 | 97 | ||
@@ -1109,6 +1131,12 @@ struct sway_binding *sway_binding_dup(struct sway_binding *sb) { | |||
1109 | return new_sb; | 1131 | return new_sb; |
1110 | } | 1132 | } |
1111 | 1133 | ||
1134 | static void set_bar_color(char **name, char *value) { | ||
1135 | // every color has 9 characters plus \0 | ||
1136 | *name = malloc(10); | ||
1137 | strcpy(*name, value); | ||
1138 | } | ||
1139 | |||
1112 | struct bar_config *default_bar_config(void) { | 1140 | struct bar_config *default_bar_config(void) { |
1113 | struct bar_config *bar = NULL; | 1141 | struct bar_config *bar = NULL; |
1114 | bar = malloc(sizeof(struct bar_config)); | 1142 | bar = malloc(sizeof(struct bar_config)); |
@@ -1132,24 +1160,28 @@ struct bar_config *default_bar_config(void) { | |||
1132 | bar->verbose = false; | 1160 | bar->verbose = false; |
1133 | bar->pid = 0; | 1161 | bar->pid = 0; |
1134 | // set default colors | 1162 | // set default colors |
1135 | strcpy(bar->colors.background, "#000000ff"); | 1163 | set_bar_color(&(bar->colors.background), "#000000ff"); |
1136 | strcpy(bar->colors.statusline, "#ffffffff"); | 1164 | set_bar_color(&(bar->colors.statusline), "#ffffffff"); |
1137 | strcpy(bar->colors.separator, "#666666ff"); | 1165 | set_bar_color(&(bar->colors.separator), "#666666ff"); |
1138 | strcpy(bar->colors.focused_workspace_border, "#4c7899ff"); | 1166 | set_bar_color(&(bar->colors.focused_workspace_border), "#4c7899ff"); |
1139 | strcpy(bar->colors.focused_workspace_bg, "#285577ff"); | 1167 | set_bar_color(&(bar->colors.focused_workspace_bg), "#285577ff"); |
1140 | strcpy(bar->colors.focused_workspace_text, "#ffffffff"); | 1168 | set_bar_color(&(bar->colors.focused_workspace_text), "#ffffffff"); |
1141 | strcpy(bar->colors.active_workspace_border, "#333333ff"); | 1169 | set_bar_color(&(bar->colors.active_workspace_border), "#333333ff"); |
1142 | strcpy(bar->colors.active_workspace_bg, "#5f676aff"); | 1170 | set_bar_color(&(bar->colors.active_workspace_bg), "#5f676aff"); |
1143 | strcpy(bar->colors.active_workspace_text, "#ffffffff"); | 1171 | set_bar_color(&(bar->colors.active_workspace_text), "#ffffffff"); |
1144 | strcpy(bar->colors.inactive_workspace_border, "#333333ff"); | 1172 | set_bar_color(&(bar->colors.inactive_workspace_border), "#333333ff"); |
1145 | strcpy(bar->colors.inactive_workspace_bg,"#222222ff"); | 1173 | set_bar_color(&(bar->colors.inactive_workspace_bg),"#222222ff"); |
1146 | strcpy(bar->colors.inactive_workspace_text, "#888888ff"); | 1174 | set_bar_color(&(bar->colors.inactive_workspace_text), "#888888ff"); |
1147 | strcpy(bar->colors.urgent_workspace_border, "#2f343aff"); | 1175 | set_bar_color(&(bar->colors.urgent_workspace_border), "#2f343aff"); |
1148 | strcpy(bar->colors.urgent_workspace_bg,"#900000ff"); | 1176 | set_bar_color(&(bar->colors.urgent_workspace_bg),"#900000ff"); |
1149 | strcpy(bar->colors.urgent_workspace_text, "#ffffffff"); | 1177 | set_bar_color(&(bar->colors.urgent_workspace_text), "#ffffffff"); |
1150 | bar->colors.has_binding_mode_border = false; | 1178 | |
1151 | bar->colors.has_binding_mode_bg = false; | 1179 | bar->colors.focused_background = NULL; |
1152 | bar->colors.has_binding_mode_text = false; | 1180 | bar->colors.focused_statusline = NULL; |
1181 | bar->colors.focused_separator = NULL; | ||
1182 | bar->colors.binding_mode_border = NULL; | ||
1183 | bar->colors.binding_mode_bg = NULL; | ||
1184 | bar->colors.binding_mode_text = NULL; | ||
1153 | 1185 | ||
1154 | list_add(config->bars, bar); | 1186 | list_add(config->bars, bar); |
1155 | 1187 | ||
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index c21d28af..e65e9de3 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -312,19 +312,19 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) { | |||
312 | json_object_object_add(colors, "statusline", json_object_new_string(bar->colors.statusline)); | 312 | json_object_object_add(colors, "statusline", json_object_new_string(bar->colors.statusline)); |
313 | json_object_object_add(colors, "separator", json_object_new_string(bar->colors.separator)); | 313 | json_object_object_add(colors, "separator", json_object_new_string(bar->colors.separator)); |
314 | 314 | ||
315 | if (bar->colors.has_focused_background) { | 315 | if (bar->colors.focused_background) { |
316 | json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.focused_background)); | 316 | json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.focused_background)); |
317 | } else { | 317 | } else { |
318 | json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.background)); | 318 | json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.background)); |
319 | } | 319 | } |
320 | 320 | ||
321 | if (bar->colors.has_focused_statusline) { | 321 | if (bar->colors.focused_statusline) { |
322 | json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.focused_statusline)); | 322 | json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.focused_statusline)); |
323 | } else { | 323 | } else { |
324 | json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.statusline)); | 324 | json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.statusline)); |
325 | } | 325 | } |
326 | 326 | ||
327 | if (bar->colors.has_focused_separator) { | 327 | if (bar->colors.focused_separator) { |
328 | json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.focused_separator)); | 328 | json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.focused_separator)); |
329 | } else { | 329 | } else { |
330 | json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.separator)); | 330 | json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.separator)); |
@@ -346,19 +346,19 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) { | |||
346 | json_object_object_add(colors, "urgent_workspace_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); | 346 | json_object_object_add(colors, "urgent_workspace_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); |
347 | json_object_object_add(colors, "urgent_workspace_text", json_object_new_string(bar->colors.urgent_workspace_text)); | 347 | json_object_object_add(colors, "urgent_workspace_text", json_object_new_string(bar->colors.urgent_workspace_text)); |
348 | 348 | ||
349 | if (bar->colors.has_binding_mode_border) { | 349 | if (bar->colors.binding_mode_border) { |
350 | json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.binding_mode_border)); | 350 | json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.binding_mode_border)); |
351 | } else { | 351 | } else { |
352 | json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.urgent_workspace_border)); | 352 | json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.urgent_workspace_border)); |
353 | } | 353 | } |
354 | 354 | ||
355 | if (bar->colors.has_binding_mode_bg) { | 355 | if (bar->colors.binding_mode_bg) { |
356 | json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.binding_mode_bg)); | 356 | json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.binding_mode_bg)); |
357 | } else { | 357 | } else { |
358 | json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); | 358 | json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); |
359 | } | 359 | } |
360 | 360 | ||
361 | if (bar->colors.has_binding_mode_text) { | 361 | if (bar->colors.binding_mode_text) { |
362 | json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.binding_mode_text)); | 362 | json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.binding_mode_text)); |
363 | } else { | 363 | } else { |
364 | json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.urgent_workspace_text)); | 364 | json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.urgent_workspace_text)); |