diff options
author | 2019-09-02 21:41:11 -0400 | |
---|---|---|
committer | 2019-09-04 16:48:50 -1000 | |
commit | 1fd2c6ba498e61f4fe823bf552f9d2fce8612de4 (patch) | |
tree | 8e2d9adab3451f1f05c76340d466a442c840e558 /sway/commands/bar/hidden_state.c | |
parent | seatop_default: only focus container on press (diff) | |
download | sway-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/hidden_state.c')
-rw-r--r-- | sway/commands/bar/hidden_state.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c index b2c2d245..1f08a5d2 100644 --- a/sway/commands/bar/hidden_state.c +++ b/sway/commands/bar/hidden_state.c | |||
@@ -23,7 +23,7 @@ static struct cmd_results *bar_set_hidden_state(struct bar_config *bar, | |||
23 | return cmd_results_new(CMD_INVALID, "Invalid value %s", hidden_state); | 23 | return cmd_results_new(CMD_INVALID, "Invalid value %s", hidden_state); |
24 | } | 24 | } |
25 | if (strcmp(old_state, bar->hidden_state) != 0) { | 25 | if (strcmp(old_state, bar->hidden_state) != 0) { |
26 | if (!config->reading) { | 26 | if (!config->current_bar) { |
27 | ipc_event_barconfig_update(bar); | 27 | ipc_event_barconfig_update(bar); |
28 | } | 28 | } |
29 | sway_log(SWAY_DEBUG, "Setting hidden_state: '%s' for bar: %s", | 29 | sway_log(SWAY_DEBUG, "Setting hidden_state: '%s' for bar: %s", |
@@ -47,6 +47,12 @@ struct cmd_results *bar_cmd_hidden_state(int argc, char **argv) { | |||
47 | "Unexpected value %s in config mode", argv[1]); | 47 | "Unexpected value %s in config mode", argv[1]); |
48 | } | 48 | } |
49 | 49 | ||
50 | if (config->current_bar && argc == 2 && | ||
51 | strcmp(config->current_bar->id, argv[1]) != 0) { | ||
52 | return cmd_results_new(CMD_INVALID, "Conflicting bar ids: %s and %s", | ||
53 | config->current_bar->id, argv[1]); | ||
54 | } | ||
55 | |||
50 | const char *state = argv[0]; | 56 | const char *state = argv[0]; |
51 | if (config->reading) { | 57 | if (config->reading) { |
52 | error = bar_set_hidden_state(config->current_bar, state); | 58 | error = bar_set_hidden_state(config->current_bar, state); |