]> git.sur5r.net Git - i3/i3/blob - src/config_directives.c
Merge pull request #1657 from Georgiy-Tugai/fix-flickering-shortened
[i3/i3] / src / config_directives.c
1 #undef I3__FILE__
2 #define I3__FILE__ "config_directives.c"
3 /*
4  * vim:ts=4:sw=4:expandtab
5  *
6  * i3 - an improved dynamic tiling window manager
7  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
8  *
9  * config_directives.c: all config storing functions (see config_parser.c)
10  *
11  */
12 #include <float.h>
13 #include <stdarg.h>
14
15 #include "all.h"
16
17 /*******************************************************************************
18  * Criteria functions.
19  ******************************************************************************/
20
21 static int criteria_next_state;
22
23 /*
24  * Initializes the specified 'Match' data structure and the initial state of
25  * commands.c for matching target windows of a command.
26  *
27  */
28 CFGFUN(criteria_init, int _state) {
29     criteria_next_state = _state;
30
31     DLOG("Initializing criteria, current_match = %p, state = %d\n", current_match, _state);
32     match_init(current_match);
33 }
34
35 CFGFUN(criteria_pop_state) {
36     result->next_state = criteria_next_state;
37 }
38
39 /*
40  * Interprets a ctype=cvalue pair and adds it to the current match
41  * specification.
42  *
43  */
44 CFGFUN(criteria_add, const char *ctype, const char *cvalue) {
45     DLOG("ctype=*%s*, cvalue=*%s*\n", ctype, cvalue);
46
47     if (strcmp(ctype, "class") == 0) {
48         current_match->class = regex_new(cvalue);
49         return;
50     }
51
52     if (strcmp(ctype, "instance") == 0) {
53         current_match->instance = regex_new(cvalue);
54         return;
55     }
56
57     if (strcmp(ctype, "window_role") == 0) {
58         current_match->window_role = regex_new(cvalue);
59         return;
60     }
61
62     if (strcmp(ctype, "con_id") == 0) {
63         char *end;
64         long parsed = strtol(cvalue, &end, 10);
65         if (parsed == LONG_MIN ||
66             parsed == LONG_MAX ||
67             parsed < 0 ||
68             (end && *end != '\0')) {
69             ELOG("Could not parse con id \"%s\"\n", cvalue);
70         } else {
71             current_match->con_id = (Con *)parsed;
72             DLOG("id as int = %p\n", current_match->con_id);
73         }
74         return;
75     }
76
77     if (strcmp(ctype, "id") == 0) {
78         char *end;
79         long parsed = strtol(cvalue, &end, 10);
80         if (parsed == LONG_MIN ||
81             parsed == LONG_MAX ||
82             parsed < 0 ||
83             (end && *end != '\0')) {
84             ELOG("Could not parse window id \"%s\"\n", cvalue);
85         } else {
86             current_match->id = parsed;
87             DLOG("window id as int = %d\n", current_match->id);
88         }
89         return;
90     }
91
92     if (strcmp(ctype, "window_type") == 0) {
93         if (strcasecmp(cvalue, "normal") == 0)
94             current_match->window_type = A__NET_WM_WINDOW_TYPE_NORMAL;
95         else if (strcasecmp(cvalue, "dialog") == 0)
96             current_match->window_type = A__NET_WM_WINDOW_TYPE_DIALOG;
97         else if (strcasecmp(cvalue, "utility") == 0)
98             current_match->window_type = A__NET_WM_WINDOW_TYPE_UTILITY;
99         else if (strcasecmp(cvalue, "toolbar") == 0)
100             current_match->window_type = A__NET_WM_WINDOW_TYPE_TOOLBAR;
101         else if (strcasecmp(cvalue, "splash") == 0)
102             current_match->window_type = A__NET_WM_WINDOW_TYPE_SPLASH;
103         else if (strcasecmp(cvalue, "menu") == 0)
104             current_match->window_type = A__NET_WM_WINDOW_TYPE_MENU;
105         else if (strcasecmp(cvalue, "dropdown_menu") == 0)
106             current_match->window_type = A__NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
107         else if (strcasecmp(cvalue, "popup_menu") == 0)
108             current_match->window_type = A__NET_WM_WINDOW_TYPE_POPUP_MENU;
109         else if (strcasecmp(cvalue, "tooltip") == 0)
110             current_match->window_type = A__NET_WM_WINDOW_TYPE_TOOLTIP;
111         else
112             ELOG("unknown window_type value \"%s\"\n", cvalue);
113
114         return;
115     }
116
117     if (strcmp(ctype, "con_mark") == 0) {
118         current_match->mark = regex_new(cvalue);
119         return;
120     }
121
122     if (strcmp(ctype, "title") == 0) {
123         current_match->title = regex_new(cvalue);
124         return;
125     }
126
127     if (strcmp(ctype, "urgent") == 0) {
128         if (strcasecmp(cvalue, "latest") == 0 ||
129             strcasecmp(cvalue, "newest") == 0 ||
130             strcasecmp(cvalue, "recent") == 0 ||
131             strcasecmp(cvalue, "last") == 0) {
132             current_match->urgent = U_LATEST;
133         } else if (strcasecmp(cvalue, "oldest") == 0 ||
134                    strcasecmp(cvalue, "first") == 0) {
135             current_match->urgent = U_OLDEST;
136         }
137         return;
138     }
139
140     ELOG("Unknown criterion: %s\n", ctype);
141 }
142
143 /* TODO: refactor the above criteria code into a single file (with src/commands.c). */
144
145 /*******************************************************************************
146  * Utility functions
147  ******************************************************************************/
148
149 static bool eval_boolstr(const char *str) {
150     return (strcasecmp(str, "1") == 0 ||
151             strcasecmp(str, "yes") == 0 ||
152             strcasecmp(str, "true") == 0 ||
153             strcasecmp(str, "on") == 0 ||
154             strcasecmp(str, "enable") == 0 ||
155             strcasecmp(str, "active") == 0);
156 }
157
158 /*
159  * A utility function to convert a string of modifiers to the corresponding bit
160  * mask.
161  */
162 uint32_t modifiers_from_str(const char *str) {
163     /* It might be better to use strtok() here, but the simpler strstr() should
164      * do for now. */
165     uint32_t result = 0;
166     if (str == NULL)
167         return result;
168     if (strstr(str, "Mod1") != NULL)
169         result |= BIND_MOD1;
170     if (strstr(str, "Mod2") != NULL)
171         result |= BIND_MOD2;
172     if (strstr(str, "Mod3") != NULL)
173         result |= BIND_MOD3;
174     if (strstr(str, "Mod4") != NULL)
175         result |= BIND_MOD4;
176     if (strstr(str, "Mod5") != NULL)
177         result |= BIND_MOD5;
178     if (strstr(str, "Control") != NULL ||
179         strstr(str, "Ctrl") != NULL)
180         result |= BIND_CONTROL;
181     if (strstr(str, "Shift") != NULL)
182         result |= BIND_SHIFT;
183     if (strstr(str, "Mode_switch") != NULL)
184         result |= BIND_MODE_SWITCH;
185     return result;
186 }
187
188 static char *font_pattern;
189
190 CFGFUN(font, const char *font) {
191     config.font = load_font(font, true);
192     set_font(&config.font);
193
194     /* Save the font pattern for using it as bar font later on */
195     FREE(font_pattern);
196     font_pattern = sstrdup(font);
197 }
198
199 CFGFUN(binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *command) {
200     configure_binding(bindtype, modifiers, key, release, border, whole_window, command, DEFAULT_BINDING_MODE);
201 }
202
203 /*******************************************************************************
204  * Mode handling
205  ******************************************************************************/
206
207 static char *current_mode;
208
209 CFGFUN(mode_binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *command) {
210     configure_binding(bindtype, modifiers, key, release, border, whole_window, command, current_mode);
211 }
212
213 CFGFUN(enter_mode, const char *modename) {
214     if (strcasecmp(modename, DEFAULT_BINDING_MODE) == 0) {
215         ELOG("You cannot use the name %s for your mode\n", DEFAULT_BINDING_MODE);
216         exit(1);
217     }
218     DLOG("\t now in mode %s\n", modename);
219     FREE(current_mode);
220     current_mode = sstrdup(modename);
221 }
222
223 CFGFUN(exec, const char *exectype, const char *no_startup_id, const char *command) {
224     struct Autostart *new = smalloc(sizeof(struct Autostart));
225     new->command = sstrdup(command);
226     new->no_startup_id = (no_startup_id != NULL);
227     if (strcmp(exectype, "exec") == 0) {
228         TAILQ_INSERT_TAIL(&autostarts, new, autostarts);
229     } else {
230         TAILQ_INSERT_TAIL(&autostarts_always, new, autostarts_always);
231     }
232 }
233
234 CFGFUN(for_window, const char *command) {
235     if (match_is_empty(current_match)) {
236         ELOG("Match is empty, ignoring this for_window statement\n");
237         return;
238     }
239     DLOG("\t should execute command %s for the criteria mentioned above\n", command);
240     Assignment *assignment = scalloc(sizeof(Assignment));
241     assignment->type = A_COMMAND;
242     match_copy(&(assignment->match), current_match);
243     assignment->dest.command = sstrdup(command);
244     TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
245 }
246
247 CFGFUN(floating_minimum_size, const long width, const long height) {
248     config.floating_minimum_width = width;
249     config.floating_minimum_height = height;
250 }
251
252 CFGFUN(floating_maximum_size, const long width, const long height) {
253     config.floating_maximum_width = width;
254     config.floating_maximum_height = height;
255 }
256
257 CFGFUN(floating_modifier, const char *modifiers) {
258     config.floating_modifier = modifiers_from_str(modifiers);
259 }
260
261 CFGFUN(default_orientation, const char *orientation) {
262     if (strcmp(orientation, "horizontal") == 0)
263         config.default_orientation = HORIZ;
264     else if (strcmp(orientation, "vertical") == 0)
265         config.default_orientation = VERT;
266     else
267         config.default_orientation = NO_ORIENTATION;
268 }
269
270 CFGFUN(workspace_layout, const char *layout) {
271     if (strcmp(layout, "default") == 0)
272         config.default_layout = L_DEFAULT;
273     else if (strcmp(layout, "stacking") == 0 ||
274              strcmp(layout, "stacked") == 0)
275         config.default_layout = L_STACKED;
276     else
277         config.default_layout = L_TABBED;
278 }
279
280 CFGFUN(new_window, const char *windowtype, const char *border, const long width) {
281     int border_style;
282     int border_width;
283
284     if (strcmp(border, "1pixel") == 0) {
285         border_style = BS_PIXEL;
286         border_width = 1;
287     } else if (strcmp(border, "none") == 0) {
288         border_style = BS_NONE;
289         border_width = 0;
290     } else if (strcmp(border, "pixel") == 0) {
291         border_style = BS_PIXEL;
292         border_width = width;
293     } else {
294         border_style = BS_NORMAL;
295         border_width = width;
296     }
297
298     if (strcmp(windowtype, "new_window") == 0) {
299         DLOG("default tiled border style = %d and border width = %d (%d physical px)\n",
300              border_style, border_width, logical_px(border_width));
301         config.default_border = border_style;
302         config.default_border_width = logical_px(border_width);
303     } else {
304         DLOG("default floating border style = %d and border width = %d (%d physical px)\n",
305              border_style, border_width, logical_px(border_width));
306         config.default_floating_border = border_style;
307         config.default_floating_border_width = logical_px(border_width);
308     }
309 }
310
311 CFGFUN(hide_edge_borders, const char *borders) {
312     if (strcmp(borders, "vertical") == 0)
313         config.hide_edge_borders = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE;
314     else if (strcmp(borders, "horizontal") == 0)
315         config.hide_edge_borders = ADJ_UPPER_SCREEN_EDGE | ADJ_LOWER_SCREEN_EDGE;
316     else if (strcmp(borders, "both") == 0)
317         config.hide_edge_borders = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE | ADJ_UPPER_SCREEN_EDGE | ADJ_LOWER_SCREEN_EDGE;
318     else if (strcmp(borders, "none") == 0)
319         config.hide_edge_borders = ADJ_NONE;
320     else if (eval_boolstr(borders))
321         config.hide_edge_borders = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE;
322     else
323         config.hide_edge_borders = ADJ_NONE;
324 }
325
326 CFGFUN(focus_follows_mouse, const char *value) {
327     config.disable_focus_follows_mouse = !eval_boolstr(value);
328 }
329
330 CFGFUN(mouse_warping, const char *value) {
331     if (strcmp(value, "none") == 0)
332         config.mouse_warping = POINTER_WARPING_NONE;
333     else if (strcmp(value, "output") == 0)
334         config.mouse_warping = POINTER_WARPING_OUTPUT;
335 }
336
337 CFGFUN(force_xinerama, const char *value) {
338     config.force_xinerama = eval_boolstr(value);
339 }
340
341 CFGFUN(force_focus_wrapping, const char *value) {
342     config.force_focus_wrapping = eval_boolstr(value);
343 }
344
345 CFGFUN(workspace_back_and_forth, const char *value) {
346     config.workspace_auto_back_and_forth = eval_boolstr(value);
347 }
348
349 CFGFUN(fake_outputs, const char *outputs) {
350     config.fake_outputs = sstrdup(outputs);
351 }
352
353 CFGFUN(force_display_urgency_hint, const long duration_ms) {
354     config.workspace_urgency_timer = duration_ms / 1000.0;
355 }
356
357 CFGFUN(focus_on_window_activation, const char *mode) {
358     if (strcmp(mode, "smart") == 0)
359         config.focus_on_window_activation = FOWA_SMART;
360     else if (strcmp(mode, "urgent") == 0)
361         config.focus_on_window_activation = FOWA_URGENT;
362     else if (strcmp(mode, "focus") == 0)
363         config.focus_on_window_activation = FOWA_FOCUS;
364     else if (strcmp(mode, "none") == 0)
365         config.focus_on_window_activation = FOWA_NONE;
366     else {
367         ELOG("Unknown focus_on_window_activation mode \"%s\", ignoring it.\n", mode);
368         return;
369     }
370
371     DLOG("Set new focus_on_window_activation mode = %i", config.focus_on_window_activation);
372 }
373
374 CFGFUN(show_marks, const char *value) {
375     config.show_marks = eval_boolstr(value);
376 }
377
378 CFGFUN(workspace, const char *workspace, const char *output) {
379     DLOG("Assigning workspace \"%s\" to output \"%s\"\n", workspace, output);
380     /* Check for earlier assignments of the same workspace so that we
381      * don’t have assignments of a single workspace to different
382      * outputs */
383     struct Workspace_Assignment *assignment;
384     bool duplicate = false;
385     TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
386         if (strcasecmp(assignment->name, workspace) == 0) {
387             ELOG("You have a duplicate workspace assignment for workspace \"%s\"\n",
388                  workspace);
389             assignment->output = sstrdup(output);
390             duplicate = true;
391         }
392     }
393     if (!duplicate) {
394         assignment = scalloc(sizeof(struct Workspace_Assignment));
395         assignment->name = sstrdup(workspace);
396         assignment->output = sstrdup(output);
397         TAILQ_INSERT_TAIL(&ws_assignments, assignment, ws_assignments);
398     }
399 }
400
401 CFGFUN(ipc_socket, const char *path) {
402     config.ipc_socket_path = sstrdup(path);
403 }
404
405 CFGFUN(restart_state, const char *path) {
406     config.restart_state_path = sstrdup(path);
407 }
408
409 CFGFUN(popup_during_fullscreen, const char *value) {
410     if (strcmp(value, "ignore") == 0) {
411         config.popup_during_fullscreen = PDF_IGNORE;
412     } else if (strcmp(value, "leave_fullscreen") == 0) {
413         config.popup_during_fullscreen = PDF_LEAVE_FULLSCREEN;
414     } else {
415         config.popup_during_fullscreen = PDF_SMART;
416     }
417 }
418
419 CFGFUN(color_single, const char *colorclass, const char *color) {
420     /* used for client.background only currently */
421     config.client.background = get_colorpixel(color);
422 }
423
424 CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator) {
425 #define APPLY_COLORS(classname)                                                \
426     do {                                                                       \
427         if (strcmp(colorclass, "client." #classname) == 0) {                   \
428             config.client.classname.border = get_colorpixel(border);           \
429             config.client.classname.background = get_colorpixel(background);   \
430             config.client.classname.text = get_colorpixel(text);               \
431             if (indicator != NULL) {                                           \
432                 config.client.classname.indicator = get_colorpixel(indicator); \
433             }                                                                  \
434         }                                                                      \
435     } while (0)
436
437     APPLY_COLORS(focused_inactive);
438     APPLY_COLORS(focused);
439     APPLY_COLORS(unfocused);
440     APPLY_COLORS(urgent);
441     APPLY_COLORS(placeholder);
442
443 #undef APPLY_COLORS
444 }
445
446 CFGFUN(assign, const char *workspace) {
447     if (match_is_empty(current_match)) {
448         ELOG("Match is empty, ignoring this assignment\n");
449         return;
450     }
451     DLOG("new assignment, using above criteria, to workspace %s\n", workspace);
452     Assignment *assignment = scalloc(sizeof(Assignment));
453     match_copy(&(assignment->match), current_match);
454     assignment->type = A_TO_WORKSPACE;
455     assignment->dest.workspace = sstrdup(workspace);
456     TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
457 }
458
459 CFGFUN(no_focus) {
460     if (match_is_empty(current_match)) {
461         ELOG("Match is empty, ignoring this assignment\n");
462         return;
463     }
464
465     DLOG("new assignment, using above criteria, to ignore focus on manage");
466     Assignment *assignment = scalloc(sizeof(Assignment));
467     match_copy(&(assignment->match), current_match);
468     assignment->type = A_NO_FOCUS;
469     TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
470 }
471
472 /*******************************************************************************
473  * Bar configuration (i3bar)
474  ******************************************************************************/
475
476 static Barconfig current_bar;
477
478 CFGFUN(bar_font, const char *font) {
479     FREE(current_bar.font);
480     current_bar.font = sstrdup(font);
481 }
482
483 CFGFUN(bar_separator_symbol, const char *separator) {
484     FREE(current_bar.separator_symbol);
485     current_bar.separator_symbol = sstrdup(separator);
486 }
487
488 CFGFUN(bar_mode, const char *mode) {
489     current_bar.mode = (strcmp(mode, "dock") == 0 ? M_DOCK : (strcmp(mode, "hide") == 0 ? M_HIDE : M_INVISIBLE));
490 }
491
492 CFGFUN(bar_hidden_state, const char *hidden_state) {
493     current_bar.hidden_state = (strcmp(hidden_state, "hide") == 0 ? S_HIDE : S_SHOW);
494 }
495
496 CFGFUN(bar_id, const char *bar_id) {
497     current_bar.id = sstrdup(bar_id);
498 }
499
500 CFGFUN(bar_output, const char *output) {
501     int new_outputs = current_bar.num_outputs + 1;
502     current_bar.outputs = srealloc(current_bar.outputs, sizeof(char *) * new_outputs);
503     current_bar.outputs[current_bar.num_outputs] = sstrdup(output);
504     current_bar.num_outputs = new_outputs;
505 }
506
507 CFGFUN(bar_verbose, const char *verbose) {
508     current_bar.verbose = eval_boolstr(verbose);
509 }
510
511 CFGFUN(bar_modifier, const char *modifier) {
512     if (strcmp(modifier, "Mod1") == 0)
513         current_bar.modifier = M_MOD1;
514     else if (strcmp(modifier, "Mod2") == 0)
515         current_bar.modifier = M_MOD2;
516     else if (strcmp(modifier, "Mod3") == 0)
517         current_bar.modifier = M_MOD3;
518     else if (strcmp(modifier, "Mod4") == 0)
519         current_bar.modifier = M_MOD4;
520     else if (strcmp(modifier, "Mod5") == 0)
521         current_bar.modifier = M_MOD5;
522     else if (strcmp(modifier, "Control") == 0 ||
523              strcmp(modifier, "Ctrl") == 0)
524         current_bar.modifier = M_CONTROL;
525     else if (strcmp(modifier, "Shift") == 0)
526         current_bar.modifier = M_SHIFT;
527 }
528
529 CFGFUN(bar_wheel_up_cmd, const char *command) {
530     FREE(current_bar.wheel_up_cmd);
531     current_bar.wheel_up_cmd = sstrdup(command);
532 }
533
534 CFGFUN(bar_wheel_down_cmd, const char *command) {
535     FREE(current_bar.wheel_down_cmd);
536     current_bar.wheel_down_cmd = sstrdup(command);
537 }
538
539 CFGFUN(bar_position, const char *position) {
540     current_bar.position = (strcmp(position, "top") == 0 ? P_TOP : P_BOTTOM);
541 }
542
543 CFGFUN(bar_i3bar_command, const char *i3bar_command) {
544     FREE(current_bar.i3bar_command);
545     current_bar.i3bar_command = sstrdup(i3bar_command);
546 }
547
548 CFGFUN(bar_color, const char *colorclass, const char *border, const char *background, const char *text) {
549 #define APPLY_COLORS(classname)                                          \
550     do {                                                                 \
551         if (strcmp(colorclass, #classname) == 0) {                       \
552             if (text != NULL) {                                          \
553                 /* New syntax: border, background, text */               \
554                 current_bar.colors.classname##_border = sstrdup(border); \
555                 current_bar.colors.classname##_bg = sstrdup(background); \
556                 current_bar.colors.classname##_text = sstrdup(text);     \
557             } else {                                                     \
558                 /* Old syntax: text, background */                       \
559                 current_bar.colors.classname##_bg = sstrdup(background); \
560                 current_bar.colors.classname##_text = sstrdup(border);   \
561             }                                                            \
562         }                                                                \
563     } while (0)
564
565     APPLY_COLORS(focused_workspace);
566     APPLY_COLORS(active_workspace);
567     APPLY_COLORS(inactive_workspace);
568     APPLY_COLORS(urgent_workspace);
569
570 #undef APPLY_COLORS
571 }
572
573 CFGFUN(bar_socket_path, const char *socket_path) {
574     FREE(current_bar.socket_path);
575     current_bar.socket_path = sstrdup(socket_path);
576 }
577
578 CFGFUN(bar_tray_output, const char *output) {
579     FREE(current_bar.tray_output);
580     current_bar.tray_output = sstrdup(output);
581 }
582
583 CFGFUN(bar_color_single, const char *colorclass, const char *color) {
584     if (strcmp(colorclass, "background") == 0)
585         current_bar.colors.background = sstrdup(color);
586     else if (strcmp(colorclass, "separator") == 0)
587         current_bar.colors.separator = sstrdup(color);
588     else
589         current_bar.colors.statusline = sstrdup(color);
590 }
591
592 CFGFUN(bar_status_command, const char *command) {
593     FREE(current_bar.status_command);
594     current_bar.status_command = sstrdup(command);
595 }
596
597 CFGFUN(bar_binding_mode_indicator, const char *value) {
598     current_bar.hide_binding_mode_indicator = !eval_boolstr(value);
599 }
600
601 CFGFUN(bar_workspace_buttons, const char *value) {
602     current_bar.hide_workspace_buttons = !eval_boolstr(value);
603 }
604
605 CFGFUN(bar_strip_workspace_numbers, const char *value) {
606     current_bar.strip_workspace_numbers = eval_boolstr(value);
607 }
608
609 CFGFUN(bar_finish) {
610     DLOG("\t new bar configuration finished, saving.\n");
611     /* Generate a unique ID for this bar if not already configured */
612     if (!current_bar.id)
613         sasprintf(&current_bar.id, "bar-%d", config.number_barconfigs);
614
615     config.number_barconfigs++;
616
617     /* If no font was explicitly set, we use the i3 font as default */
618     if (!current_bar.font && font_pattern)
619         current_bar.font = sstrdup(font_pattern);
620
621     /* Copy the current (static) structure into a dynamically allocated
622      * one, then cleanup our static one. */
623     Barconfig *bar_config = scalloc(sizeof(Barconfig));
624     memcpy(bar_config, &current_bar, sizeof(Barconfig));
625     TAILQ_INSERT_TAIL(&barconfigs, bar_config, configs);
626
627     memset(&current_bar, '\0', sizeof(Barconfig));
628 }