diff options
author | 2018-10-10 17:07:02 +0200 | |
---|---|---|
committer | 2018-10-10 17:07:02 +0200 | |
commit | 0a36d14d7a694a88580da1d9b83837afe608a2eb (patch) | |
tree | e21f0b633212c6b8084348f08fc68cec2efece8b /swaybar/config.c | |
parent | Merge pull request #2814 from Emantor/mouse-warping-container (diff) | |
parent | Merge branch 'master' into bar-bindsym (diff) | |
download | sway-0a36d14d7a694a88580da1d9b83837afe608a2eb.tar.gz sway-0a36d14d7a694a88580da1d9b83837afe608a2eb.tar.zst sway-0a36d14d7a694a88580da1d9b83837afe608a2eb.zip |
Merge pull request #2798 from RedSoxFan/bar-bindsym
Implement bar bindsym
Diffstat (limited to 'swaybar/config.c')
-rw-r--r-- | swaybar/config.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/swaybar/config.c b/swaybar/config.c index 4e851cca..09d40c24 100644 --- a/swaybar/config.c +++ b/swaybar/config.c | |||
@@ -3,6 +3,8 @@ | |||
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include "swaybar/config.h" | 4 | #include "swaybar/config.h" |
5 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 5 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
6 | #include "stringop.h" | ||
7 | #include "list.h" | ||
6 | 8 | ||
7 | uint32_t parse_position(const char *position) { | 9 | uint32_t parse_position(const char *position) { |
8 | uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | | 10 | uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | |
@@ -34,6 +36,7 @@ struct swaybar_config *init_config(void) { | |||
34 | config->binding_mode_indicator = true; | 36 | config->binding_mode_indicator = true; |
35 | config->wrap_scroll = false; | 37 | config->wrap_scroll = false; |
36 | config->workspace_buttons = true; | 38 | config->workspace_buttons = true; |
39 | config->bindings = create_list(); | ||
37 | wl_list_init(&config->outputs); | 40 | wl_list_init(&config->outputs); |
38 | 41 | ||
39 | /* height */ | 42 | /* height */ |
@@ -69,11 +72,24 @@ struct swaybar_config *init_config(void) { | |||
69 | return config; | 72 | return config; |
70 | } | 73 | } |
71 | 74 | ||
75 | static void free_binding(struct swaybar_binding *binding) { | ||
76 | if (!binding) { | ||
77 | return; | ||
78 | } | ||
79 | free(binding->command); | ||
80 | free(binding); | ||
81 | } | ||
82 | |||
72 | void free_config(struct swaybar_config *config) { | 83 | void free_config(struct swaybar_config *config) { |
73 | free(config->status_command); | 84 | free(config->status_command); |
74 | free(config->font); | 85 | free(config->font); |
75 | free(config->mode); | 86 | free(config->mode); |
76 | free(config->sep_symbol); | 87 | free(config->sep_symbol); |
88 | for (int i = 0; i < config->bindings->length; i++) { | ||
89 | struct swaybar_binding *binding = config->bindings->items[i]; | ||
90 | free_binding(binding); | ||
91 | } | ||
92 | list_free(config->bindings); | ||
77 | struct config_output *coutput, *tmp; | 93 | struct config_output *coutput, *tmp; |
78 | wl_list_for_each_safe(coutput, tmp, &config->outputs, link) { | 94 | wl_list_for_each_safe(coutput, tmp, &config->outputs, link) { |
79 | wl_list_remove(&coutput->link); | 95 | wl_list_remove(&coutput->link); |