if (!strcmp(cur_key, "status_command")) {
DLOG("command = %.*s\n", len, val);
+ FREE(config.command);
sasprintf(&config.command, "%.*s", len, val);
return 1;
}
init_colors(&(config.colors));
start_child(config.command);
- FREE(config.command);
}
/* Data structure to easily call the reply handlers later */
/* update the configuration with the received settings */
DLOG("Received bar config update \"%s\"\n", event);
+ char *old_command = sstrdup(config.command);
bar_display_mode_t old_mode = config.hide_on_modifier;
parse_config_json(event);
if (old_mode != config.hide_on_modifier) {
init_colors(&(config.colors));
/* restart status command process */
- kill_child();
- start_child(config.command);
- FREE(config.command);
+ if (strcmp(old_command, config.command) != 0) {
+ kill_child();
+ start_child(config.command);
+ }
+ free(old_command);
draw_bars(false);
}