aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/bar/mode.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/bar/mode.c')
-rw-r--r--sway/commands/bar/mode.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index 1081ad4b..8b3fb275 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -27,7 +27,7 @@ static struct cmd_results *bar_set_mode(struct bar_config *bar, const char *mode
}
if (strcmp(old_mode, bar->mode) != 0) {
- if (!config->reading) {
+ if (!config->current_bar) {
ipc_event_barconfig_update(bar);
}
sway_log(SWAY_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
@@ -51,6 +51,12 @@ struct cmd_results *bar_cmd_mode(int argc, char **argv) {
"Unexpected value %s in config mode", argv[1]);
}
+ if (config->current_bar && argc == 2 &&
+ strcmp(config->current_bar->id, argv[1]) != 0) {
+ return cmd_results_new(CMD_INVALID, "Conflicting bar ids: %s and %s",
+ config->current_bar->id, argv[1]);
+ }
+
const char *mode = argv[0];
if (config->reading) {
error = bar_set_mode(config->current_bar, mode);