diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-10-12 20:32:48 +0100 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-10-14 13:33:12 +0100 |
commit | bcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b (patch) | |
tree | 873a09eca473242c15299ea1053966e9d163f6c6 /swaybar/config.c | |
parent | swaybar: streamline ipc handling (diff) | |
download | sway-bcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b.tar.gz sway-bcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b.tar.zst sway-bcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b.zip |
swaybar: handle mode/hidden_state changes
As well as adding the hidden_state property to the bar config struct,
this commit handles barconfig_update events when the mode or
hidden_state changes, and uses a new function determine_bar_visibility
to hide or show the bar as required, using, respectively,
destroy_layer_surface, which is also newly added, and add_layer_surface,
which has been changed to allow dynamically adding the surface.
Diffstat (limited to 'swaybar/config.c')
-rw-r--r-- | swaybar/config.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/swaybar/config.c b/swaybar/config.c index 09d40c24..eafb0b69 100644 --- a/swaybar/config.c +++ b/swaybar/config.c | |||
@@ -30,7 +30,8 @@ struct swaybar_config *init_config(void) { | |||
30 | config->pango_markup = false; | 30 | config->pango_markup = false; |
31 | config->position = parse_position("bottom"); | 31 | config->position = parse_position("bottom"); |
32 | config->font = strdup("monospace 10"); | 32 | config->font = strdup("monospace 10"); |
33 | config->mode = NULL; | 33 | config->mode = strdup("dock"); |
34 | config->hidden_state = strdup("hide"); | ||
34 | config->sep_symbol = NULL; | 35 | config->sep_symbol = NULL; |
35 | config->strip_workspace_numbers = false; | 36 | config->strip_workspace_numbers = false; |
36 | config->binding_mode_indicator = true; | 37 | config->binding_mode_indicator = true; |
@@ -84,6 +85,7 @@ void free_config(struct swaybar_config *config) { | |||
84 | free(config->status_command); | 85 | free(config->status_command); |
85 | free(config->font); | 86 | free(config->font); |
86 | free(config->mode); | 87 | free(config->mode); |
88 | free(config->hidden_state); | ||
87 | free(config->sep_symbol); | 89 | free(config->sep_symbol); |
88 | for (int i = 0; i < config->bindings->length; i++) { | 90 | for (int i = 0; i < config->bindings->length; i++) { |
89 | struct swaybar_binding *binding = config->bindings->items[i]; | 91 | struct swaybar_binding *binding = config->bindings->items[i]; |