aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bar/mode.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-09-02 21:41:11 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-09-04 16:48:50 -1000
commit1fd2c6ba498e61f4fe823bf552f9d2fce8612de4 (patch)
tree8e2d9adab3451f1f05c76340d466a442c840e558 /sway/commands/bar/mode.c
parentseatop_default: only focus container on press (diff)
downloadsway-1fd2c6ba498e61f4fe823bf552f9d2fce8612de4.tar.gz
sway-1fd2c6ba498e61f4fe823bf552f9d2fce8612de4.tar.zst
sway-1fd2c6ba498e61f4fe823bf552f9d2fce8612de4.zip
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
27 } 27 }
28 28
29 if (strcmp(old_mode, bar->mode) != 0) { 29 if (strcmp(old_mode, bar->mode) != 0) {
30 if (!config->reading) { 30 if (!config->current_bar) {
31 ipc_event_barconfig_update(bar); 31 ipc_event_barconfig_update(bar);
32 } 32 }
33 sway_log(SWAY_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id); 33 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) {
51 "Unexpected value %s in config mode", argv[1]); 51 "Unexpected value %s in config mode", argv[1]);
52 } 52 }
53 53
54 if (config->current_bar && argc == 2 &&
55 strcmp(config->current_bar->id, argv[1]) != 0) {
56 return cmd_results_new(CMD_INVALID, "Conflicting bar ids: %s and %s",
57 config->current_bar->id, argv[1]);
58 }
59
54 const char *mode = argv[0]; 60 const char *mode = argv[0];
55 if (config->reading) { 61 if (config->reading) {
56 error = bar_set_mode(config->current_bar, mode); 62 error = bar_set_mode(config->current_bar, mode);