diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-03-29 17:41:02 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-03-29 22:11:08 -0400 |
commit | 569b2bfd5daae5b3be49772bdca4a3f224e20629 (patch) | |
tree | 56e1d9e37cc5ffdca34d2f86a0e297cd06ffaf83 /sway/config.c | |
parent | Add bar configuration commands (diff) | |
download | sway-569b2bfd5daae5b3be49772bdca4a3f224e20629.tar.gz sway-569b2bfd5daae5b3be49772bdca4a3f224e20629.tar.zst sway-569b2bfd5daae5b3be49772bdca4a3f224e20629.zip |
Move bar config into its own file
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/sway/config.c b/sway/config.c index a0e408de..0422fdd9 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -110,48 +110,6 @@ void free_config(struct sway_config *config) { | |||
110 | free(config); | 110 | free(config); |
111 | } | 111 | } |
112 | 112 | ||
113 | static void free_bar(struct bar_config *bar) { | ||
114 | if (!bar) { | ||
115 | return; | ||
116 | } | ||
117 | free(bar->mode); | ||
118 | free(bar->position); | ||
119 | free(bar->hidden_state); | ||
120 | free(bar->status_command); | ||
121 | free(bar->font); | ||
122 | free(bar->separator_symbol); | ||
123 | // TODO: Free mouse bindings | ||
124 | list_free(bar->bindings); | ||
125 | if (bar->outputs) { | ||
126 | free_flat_list(bar->outputs); | ||
127 | } | ||
128 | if (bar->pid != 0) { | ||
129 | // TODO terminate_swaybar(bar->pid); | ||
130 | } | ||
131 | free(bar->colors.background); | ||
132 | free(bar->colors.statusline); | ||
133 | free(bar->colors.separator); | ||
134 | free(bar->colors.focused_background); | ||
135 | free(bar->colors.focused_statusline); | ||
136 | free(bar->colors.focused_separator); | ||
137 | free(bar->colors.focused_workspace_border); | ||
138 | free(bar->colors.focused_workspace_bg); | ||
139 | free(bar->colors.focused_workspace_text); | ||
140 | free(bar->colors.active_workspace_border); | ||
141 | free(bar->colors.active_workspace_bg); | ||
142 | free(bar->colors.active_workspace_text); | ||
143 | free(bar->colors.inactive_workspace_border); | ||
144 | free(bar->colors.inactive_workspace_bg); | ||
145 | free(bar->colors.inactive_workspace_text); | ||
146 | free(bar->colors.urgent_workspace_border); | ||
147 | free(bar->colors.urgent_workspace_bg); | ||
148 | free(bar->colors.urgent_workspace_text); | ||
149 | free(bar->colors.binding_mode_border); | ||
150 | free(bar->colors.binding_mode_bg); | ||
151 | free(bar->colors.binding_mode_text); | ||
152 | free(bar); | ||
153 | } | ||
154 | |||
155 | static void destroy_removed_seats(struct sway_config *old_config, | 113 | static void destroy_removed_seats(struct sway_config *old_config, |
156 | struct sway_config *new_config) { | 114 | struct sway_config *new_config) { |
157 | struct seat_config *seat_config; | 115 | struct seat_config *seat_config; |
@@ -281,91 +239,6 @@ cleanup: | |||
281 | sway_abort("Unable to allocate config structures"); | 239 | sway_abort("Unable to allocate config structures"); |
282 | } | 240 | } |
283 | 241 | ||
284 | struct bar_config *default_bar_config(void) { | ||
285 | struct bar_config *bar = NULL; | ||
286 | bar = malloc(sizeof(struct bar_config)); | ||
287 | if (!bar) { | ||
288 | return NULL; | ||
289 | } | ||
290 | if (!(bar->mode = strdup("dock"))) goto cleanup; | ||
291 | if (!(bar->hidden_state = strdup("hide"))) goto cleanup; | ||
292 | bar->outputs = NULL; | ||
293 | bar->position = strdup("bottom"); | ||
294 | if (!(bar->bindings = create_list())) goto cleanup; | ||
295 | if (!(bar->status_command = strdup("while :; do date +'%Y-%m-%d %l:%M:%S %p'; sleep 1; done"))) goto cleanup; | ||
296 | bar->pango_markup = false; | ||
297 | bar->swaybar_command = NULL; | ||
298 | bar->font = NULL; | ||
299 | bar->height = -1; | ||
300 | bar->workspace_buttons = true; | ||
301 | bar->wrap_scroll = false; | ||
302 | bar->separator_symbol = NULL; | ||
303 | bar->strip_workspace_numbers = false; | ||
304 | bar->binding_mode_indicator = true; | ||
305 | bar->verbose = false; | ||
306 | bar->pid = 0; | ||
307 | // set default colors | ||
308 | if (!(bar->colors.background = strndup("#000000ff", 9))) { | ||
309 | goto cleanup; | ||
310 | } | ||
311 | if (!(bar->colors.statusline = strndup("#ffffffff", 9))) { | ||
312 | goto cleanup; | ||
313 | } | ||
314 | if (!(bar->colors.separator = strndup("#666666ff", 9))) { | ||
315 | goto cleanup; | ||
316 | } | ||
317 | if (!(bar->colors.focused_workspace_border = strndup("#4c7899ff", 9))) { | ||
318 | goto cleanup; | ||
319 | } | ||
320 | if (!(bar->colors.focused_workspace_bg = strndup("#285577ff", 9))) { | ||
321 | goto cleanup; | ||
322 | } | ||
323 | if (!(bar->colors.focused_workspace_text = strndup("#ffffffff", 9))) { | ||
324 | goto cleanup; | ||
325 | } | ||
326 | if (!(bar->colors.active_workspace_border = strndup("#333333ff", 9))) { | ||
327 | goto cleanup; | ||
328 | } | ||
329 | if (!(bar->colors.active_workspace_bg = strndup("#5f676aff", 9))) { | ||
330 | goto cleanup; | ||
331 | } | ||
332 | if (!(bar->colors.active_workspace_text = strndup("#ffffffff", 9))) { | ||
333 | goto cleanup; | ||
334 | } | ||
335 | if (!(bar->colors.inactive_workspace_border = strndup("#333333ff", 9))) { | ||
336 | goto cleanup; | ||
337 | } | ||
338 | if (!(bar->colors.inactive_workspace_bg = strndup("#222222ff", 9))) { | ||
339 | goto cleanup; | ||
340 | } | ||
341 | if (!(bar->colors.inactive_workspace_text = strndup("#888888ff", 9))) { | ||
342 | goto cleanup; | ||
343 | } | ||
344 | if (!(bar->colors.urgent_workspace_border = strndup("#2f343aff", 9))) { | ||
345 | goto cleanup; | ||
346 | } | ||
347 | if (!(bar->colors.urgent_workspace_bg = strndup("#900000ff", 9))) { | ||
348 | goto cleanup; | ||
349 | } | ||
350 | if (!(bar->colors.urgent_workspace_text = strndup("#ffffffff", 9))) { | ||
351 | goto cleanup; | ||
352 | } | ||
353 | // if the following colors stay undefined, they fall back to background, | ||
354 | // statusline, separator and urgent_workspace_*. | ||
355 | bar->colors.focused_background = NULL; | ||
356 | bar->colors.focused_statusline = NULL; | ||
357 | bar->colors.focused_separator = NULL; | ||
358 | bar->colors.binding_mode_border = NULL; | ||
359 | bar->colors.binding_mode_bg = NULL; | ||
360 | bar->colors.binding_mode_text = NULL; | ||
361 | |||
362 | list_add(config->bars, bar); | ||
363 | return bar; | ||
364 | cleanup: | ||
365 | free_bar(bar); | ||
366 | return NULL; | ||
367 | } | ||
368 | |||
369 | static bool file_exists(const char *path) { | 242 | static bool file_exists(const char *path) { |
370 | return path && access(path, R_OK) != -1; | 243 | return path && access(path, R_OK) != -1; |
371 | } | 244 | } |