diff options
Diffstat (limited to 'sway/config/bar.c')
-rw-r--r-- | sway/config/bar.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sway/config/bar.c b/sway/config/bar.c index 7bca5f49..701bf051 100644 --- a/sway/config/bar.c +++ b/sway/config/bar.c | |||
@@ -1,5 +1,4 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | 1 | #define _POSIX_C_SOURCE 200809L |
2 | #define _XOPEN_SOURCE 700 | ||
3 | #include <stdio.h> | 2 | #include <stdio.h> |
4 | #include <stdbool.h> | 3 | #include <stdbool.h> |
5 | #include <stdlib.h> | 4 | #include <stdlib.h> |
@@ -13,6 +12,7 @@ | |||
13 | #include <signal.h> | 12 | #include <signal.h> |
14 | #include "sway/config.h" | 13 | #include "sway/config.h" |
15 | #include "sway/output.h" | 14 | #include "sway/output.h" |
15 | #include "config.h" | ||
16 | #include "stringop.h" | 16 | #include "stringop.h" |
17 | #include "list.h" | 17 | #include "list.h" |
18 | #include "log.h" | 18 | #include "log.h" |
@@ -50,13 +50,10 @@ void free_bar_config(struct bar_config *bar) { | |||
50 | free(bar->font); | 50 | free(bar->font); |
51 | free(bar->separator_symbol); | 51 | free(bar->separator_symbol); |
52 | for (int i = 0; i < bar->bindings->length; i++) { | 52 | for (int i = 0; i < bar->bindings->length; i++) { |
53 | struct bar_binding *binding = bar->bindings->items[i]; | 53 | free_bar_binding(bar->bindings->items[i]); |
54 | free_bar_binding(binding); | ||
55 | } | 54 | } |
56 | list_free(bar->bindings); | 55 | list_free(bar->bindings); |
57 | if (bar->outputs) { | 56 | list_free_items_and_destroy(bar->outputs); |
58 | free_flat_list(bar->outputs); | ||
59 | } | ||
60 | if (bar->pid != 0) { | 57 | if (bar->pid != 0) { |
61 | terminate_swaybar(bar->pid); | 58 | terminate_swaybar(bar->pid); |
62 | } | 59 | } |
@@ -81,6 +78,10 @@ void free_bar_config(struct bar_config *bar) { | |||
81 | free(bar->colors.binding_mode_border); | 78 | free(bar->colors.binding_mode_border); |
82 | free(bar->colors.binding_mode_bg); | 79 | free(bar->colors.binding_mode_bg); |
83 | free(bar->colors.binding_mode_text); | 80 | free(bar->colors.binding_mode_text); |
81 | #if HAVE_TRAY | ||
82 | list_free_items_and_destroy(bar->tray_outputs); | ||
83 | free(bar->icon_theme); | ||
84 | #endif | ||
84 | free(bar); | 85 | free(bar); |
85 | } | 86 | } |
86 | 87 | ||
@@ -95,15 +96,18 @@ struct bar_config *default_bar_config(void) { | |||
95 | bar->pango_markup = false; | 96 | bar->pango_markup = false; |
96 | bar->swaybar_command = NULL; | 97 | bar->swaybar_command = NULL; |
97 | bar->font = NULL; | 98 | bar->font = NULL; |
98 | bar->height = -1; | 99 | bar->height = 0; |
99 | bar->workspace_buttons = true; | 100 | bar->workspace_buttons = true; |
100 | bar->wrap_scroll = false; | 101 | bar->wrap_scroll = false; |
101 | bar->separator_symbol = NULL; | 102 | bar->separator_symbol = NULL; |
102 | bar->strip_workspace_numbers = false; | 103 | bar->strip_workspace_numbers = false; |
104 | bar->strip_workspace_name = false; | ||
103 | bar->binding_mode_indicator = true; | 105 | bar->binding_mode_indicator = true; |
104 | bar->verbose = false; | 106 | bar->verbose = false; |
105 | bar->pid = 0; | 107 | bar->pid = 0; |
106 | bar->modifier = get_modifier_mask_by_name("Mod4"); | 108 | bar->modifier = get_modifier_mask_by_name("Mod4"); |
109 | bar->status_padding = 1; | ||
110 | bar->status_edge_padding = 3; | ||
107 | if (!(bar->mode = strdup("dock"))) { | 111 | if (!(bar->mode = strdup("dock"))) { |
108 | goto cleanup; | 112 | goto cleanup; |
109 | } | 113 | } |
@@ -168,6 +172,10 @@ struct bar_config *default_bar_config(void) { | |||
168 | bar->colors.binding_mode_bg = NULL; | 172 | bar->colors.binding_mode_bg = NULL; |
169 | bar->colors.binding_mode_text = NULL; | 173 | bar->colors.binding_mode_text = NULL; |
170 | 174 | ||
175 | #if HAVE_TRAY | ||
176 | bar->tray_padding = 2; | ||
177 | #endif | ||
178 | |||
171 | list_add(config->bars, bar); | 179 | list_add(config->bars, bar); |
172 | return bar; | 180 | return bar; |
173 | cleanup: | 181 | cleanup: |