From 39ee0ec552c05c7ab5031982a1104a0bae1910d3 Mon Sep 17 00:00:00 2001 From: "D.B" Date: Wed, 2 Nov 2016 17:09:34 +0100 Subject: use urgent_ws color in swaybar if binding_mode is undefined --- sway/ipc-json.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'sway/ipc-json.c') 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) { json_object_object_add(colors, "urgent_workspace_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); json_object_object_add(colors, "urgent_workspace_text", json_object_new_string(bar->colors.urgent_workspace_text)); - json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.binding_mode_border)); - json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.binding_mode_bg)); - json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.binding_mode_text)); + if (bar->colors.has_binding_mode_border) { + json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.binding_mode_border)); + } else { + json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.urgent_workspace_border)); + } + + if (bar->colors.has_binding_mode_bg) { + json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.binding_mode_bg)); + } else { + json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); + } + + if (bar->colors.has_binding_mode_text) { + json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.binding_mode_text)); + } else { + json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.urgent_workspace_text)); + } json_object_object_add(json, "colors", colors); -- cgit v1.2.3 From ad4d21d60b36ba39e2090fa052a29bf7ea8a3395 Mon Sep 17 00:00:00 2001 From: "D.B" Date: Wed, 2 Nov 2016 18:48:43 +0100 Subject: add bar colours for focused_(workspace|statusline|separator) If these aren't defined in config, color settings without 'focused_' prefix are used as a fallback. --- sway/ipc-json.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sway/ipc-json.c') diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 458dc7c2..c21d28af 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -312,6 +312,24 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) { json_object_object_add(colors, "statusline", json_object_new_string(bar->colors.statusline)); json_object_object_add(colors, "separator", json_object_new_string(bar->colors.separator)); + if (bar->colors.has_focused_background) { + json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.focused_background)); + } else { + json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.background)); + } + + if (bar->colors.has_focused_statusline) { + json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.focused_statusline)); + } else { + json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.statusline)); + } + + if (bar->colors.has_focused_separator) { + json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.focused_separator)); + } else { + json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.separator)); + } + json_object_object_add(colors, "focused_workspace_border", json_object_new_string(bar->colors.focused_workspace_border)); json_object_object_add(colors, "focused_workspace_bg", json_object_new_string(bar->colors.focused_workspace_bg)); json_object_object_add(colors, "focused_workspace_text", json_object_new_string(bar->colors.focused_workspace_text)); -- cgit v1.2.3 From 58eb7ac19fe436737babcbd1effd41ef96af6632 Mon Sep 17 00:00:00 2001 From: "D.B" Date: Wed, 2 Nov 2016 21:07:04 +0100 Subject: change bar colors from char[10] to *char This commit removes has_* booleans from bar color struct. It also generalizes of functions in commands/bar/colors.c. --- sway/ipc-json.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sway/ipc-json.c') 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) { json_object_object_add(colors, "statusline", json_object_new_string(bar->colors.statusline)); json_object_object_add(colors, "separator", json_object_new_string(bar->colors.separator)); - if (bar->colors.has_focused_background) { + if (bar->colors.focused_background) { json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.focused_background)); } else { json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.background)); } - if (bar->colors.has_focused_statusline) { + if (bar->colors.focused_statusline) { json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.focused_statusline)); } else { json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.statusline)); } - if (bar->colors.has_focused_separator) { + if (bar->colors.focused_separator) { json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.focused_separator)); } else { 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) { json_object_object_add(colors, "urgent_workspace_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); json_object_object_add(colors, "urgent_workspace_text", json_object_new_string(bar->colors.urgent_workspace_text)); - if (bar->colors.has_binding_mode_border) { + if (bar->colors.binding_mode_border) { json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.binding_mode_border)); } else { json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.urgent_workspace_border)); } - if (bar->colors.has_binding_mode_bg) { + if (bar->colors.binding_mode_bg) { json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.binding_mode_bg)); } else { json_object_object_add(colors, "binding_mode_bg", json_object_new_string(bar->colors.urgent_workspace_bg)); } - if (bar->colors.has_binding_mode_text) { + if (bar->colors.binding_mode_text) { json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.binding_mode_text)); } else { json_object_object_add(colors, "binding_mode_text", json_object_new_string(bar->colors.urgent_workspace_text)); -- cgit v1.2.3