Clean bars before reloading the config (+test)
While the configuration gets updated in i3, the i3bar processes will not pick up these changes. We have to think about a good way to do that.
This commit is contained in:
parent
a5be27cb79
commit
ad0f13a0a9
26
src/config.c
26
src/config.c
|
@ -295,6 +295,32 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
|
|||
FREE(assign);
|
||||
}
|
||||
|
||||
/* Clear bar configs */
|
||||
Barconfig *barconfig;
|
||||
while (!TAILQ_EMPTY(&barconfigs)) {
|
||||
barconfig = TAILQ_FIRST(&barconfigs);
|
||||
FREE(barconfig->id);
|
||||
for (int c = 0; c < barconfig->num_outputs; c++)
|
||||
free(barconfig->outputs[c]);
|
||||
FREE(barconfig->outputs);
|
||||
FREE(barconfig->tray_output);
|
||||
FREE(barconfig->socket_path);
|
||||
FREE(barconfig->status_command);
|
||||
FREE(barconfig->font);
|
||||
FREE(barconfig->colors.background);
|
||||
FREE(barconfig->colors.statusline);
|
||||
FREE(barconfig->colors.focused_workspace_text);
|
||||
FREE(barconfig->colors.focused_workspace_bg);
|
||||
FREE(barconfig->colors.active_workspace_text);
|
||||
FREE(barconfig->colors.active_workspace_bg);
|
||||
FREE(barconfig->colors.inactive_workspace_text);
|
||||
FREE(barconfig->colors.inactive_workspace_bg);
|
||||
FREE(barconfig->colors.urgent_workspace_text);
|
||||
FREE(barconfig->colors.urgent_workspace_bg);
|
||||
TAILQ_REMOVE(&barconfigs, barconfig, configs);
|
||||
FREE(barconfig);
|
||||
}
|
||||
|
||||
/* Clear workspace names */
|
||||
#if 0
|
||||
Workspace *ws;
|
||||
|
|
|
@ -54,6 +54,14 @@ ok($bar_config->{workspace_buttons}, 'workspace buttons enabled per default');
|
|||
is($bar_config->{mode}, 'hide', 'hide mode by default');
|
||||
is($bar_config->{position}, 'bottom', 'position bottom by default');
|
||||
|
||||
#####################################################################
|
||||
# ensure that reloading cleans up the old bar configs
|
||||
#####################################################################
|
||||
|
||||
cmd 'reload';
|
||||
$bars = $i3->get_bar_config()->recv;
|
||||
is(@$bars, 1, 'still one bar configured');
|
||||
|
||||
exit_gracefully($pid);
|
||||
|
||||
#####################################################################
|
||||
|
|
Loading…
Reference in New Issue