summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar D.B <thejan.2009@gmail.com>2016-11-02 17:09:34 +0100
committerLibravatar D.B <thejan.2009@gmail.com>2016-11-02 18:58:33 +0100
commit39ee0ec552c05c7ab5031982a1104a0bae1910d3 (patch)
treedaaf306035c7e925e3ca0bc7867a6b6249a60b42
parentLog LD_LIBRARY_PATH (diff)
downloadsway-39ee0ec552c05c7ab5031982a1104a0bae1910d3.tar.gz
sway-39ee0ec552c05c7ab5031982a1104a0bae1910d3.tar.zst
sway-39ee0ec552c05c7ab5031982a1104a0bae1910d3.zip
use urgent_ws color in swaybar if binding_mode is undefined
-rw-r--r--include/sway/config.h4
-rw-r--r--sway/commands/bar/colors.c6
-rw-r--r--sway/config.c6
-rw-r--r--sway/ipc-json.c20
4 files changed, 30 insertions, 6 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index a14b7e48..c41bb8b3 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -163,6 +163,10 @@ struct bar_config {
163 char binding_mode_border[10]; 163 char binding_mode_border[10];
164 char binding_mode_bg[10]; 164 char binding_mode_bg[10];
165 char binding_mode_text[10]; 165 char binding_mode_text[10];
166
167 bool has_binding_mode_border;
168 bool has_binding_mode_bg;
169 bool has_binding_mode_text;
166 } colors; 170 } colors;
167}; 171};
168 172
diff --git a/sway/commands/bar/colors.c b/sway/commands/bar/colors.c
index 9e374d88..e9180604 100644
--- a/sway/commands/bar/colors.c
+++ b/sway/commands/bar/colors.c
@@ -57,14 +57,20 @@ struct cmd_results *bar_colors_cmd_binding_mode(int argc, char **argv) {
57 57
58 if ((error = add_color("binding_mode_border", config->current_bar->colors.binding_mode_border, argv[0]))) { 58 if ((error = add_color("binding_mode_border", config->current_bar->colors.binding_mode_border, argv[0]))) {
59 return error; 59 return error;
60 } else {
61 config->current_bar->colors.has_binding_mode_border = true;
60 } 62 }
61 63
62 if ((error = add_color("binding_mode_bg", config->current_bar->colors.binding_mode_bg, argv[1]))) { 64 if ((error = add_color("binding_mode_bg", config->current_bar->colors.binding_mode_bg, argv[1]))) {
63 return error; 65 return error;
66 } else {
67 config->current_bar->colors.has_binding_mode_bg = true;
64 } 68 }
65 69
66 if ((error = add_color("binding_mode_text", config->current_bar->colors.binding_mode_text, argv[2]))) { 70 if ((error = add_color("binding_mode_text", config->current_bar->colors.binding_mode_text, argv[2]))) {
67 return error; 71 return error;
72 } else {
73 config->current_bar->colors.has_binding_mode_text = true;
68 } 74 }
69 75
70 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 76 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/config.c b/sway/config.c
index 7a41a3c8..6d4cf2ff 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -1147,9 +1147,9 @@ struct bar_config *default_bar_config(void) {
1147 strcpy(bar->colors.urgent_workspace_border, "#2f343aff"); 1147 strcpy(bar->colors.urgent_workspace_border, "#2f343aff");
1148 strcpy(bar->colors.urgent_workspace_bg,"#900000ff"); 1148 strcpy(bar->colors.urgent_workspace_bg,"#900000ff");
1149 strcpy(bar->colors.urgent_workspace_text, "#ffffffff"); 1149 strcpy(bar->colors.urgent_workspace_text, "#ffffffff");
1150 strcpy(bar->colors.binding_mode_border, "#2f343aff"); 1150 bar->colors.has_binding_mode_border = false;
1151 strcpy(bar->colors.binding_mode_bg,"#900000ff"); 1151 bar->colors.has_binding_mode_bg = false;
1152 strcpy(bar->colors.binding_mode_text, "#ffffffff"); 1152 bar->colors.has_binding_mode_text = false;
1153 1153
1154 list_add(config->bars, bar); 1154 list_add(config->bars, bar);
1155 1155
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index eb77a654..458dc7c2 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -328,9 +328,23 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) {
328 json_object_object_add(colors, "urgent_workspace_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); 328 json_object_object_add(colors, "urgent_workspace_bg", json_object_new_string(bar->colors.urgent_workspace_bg));
329 json_object_object_add(colors, "urgent_workspace_text", json_object_new_string(bar->colors.urgent_workspace_text)); 329 json_object_object_add(colors, "urgent_workspace_text", json_object_new_string(bar->colors.urgent_workspace_text));
330 330
331 json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.binding_mode_border)); 331 if (bar->colors.has_binding_mode_border) {
332 json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.binding_mode_bg)); 332 json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.binding_mode_border));
333 json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.binding_mode_text)); 333 } else {
334 json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.urgent_workspace_border));
335 }
336
337 if (bar->colors.has_binding_mode_bg) {
338 json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.binding_mode_bg));
339 } else {
340 json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.urgent_workspace_bg));
341 }
342
343 if (bar->colors.has_binding_mode_text) {
344 json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.binding_mode_text));
345 } else {
346 json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.urgent_workspace_text));
347 }
334 348
335 json_object_object_add(json, "colors", colors); 349 json_object_object_add(json, "colors", colors);
336 350