summaryrefslogtreecommitdiff
path: root/sway/commands/bar/mode.c
diff options
context:
space:
mode:
authorBrian Ashworth <[email protected]>2019-09-02 21:41:11 -0400
committerDrew DeVault <[email protected]>2019-09-04 16:48:50 -1000
commit1fd2c6ba498e61f4fe823bf552f9d2fce8612de4 (patch)
tree8e2d9adab3451f1f05c76340d466a442c840e558 /sway/commands/bar/mode.c
parent187306640ba8f2ab2f246a5030617ee985cf9223 (diff)
swaybar: complete barconfig_update event handling
This adds complete support for the barconfig_update ipc event. This also changes the bar command and subcommand handlers to correctly emit the event. This makes it so all bar subcommands other than id and swaybar_command are dynamically changeable at runtime. sway-bar.5 has been updated accordingly
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);