ipc: make bar <bar_id> mode|hidden_state behave as documented

sway-bar(5) says:

> For compatibility with i3, bar mode <mode> [<bar-id>] syntax is
> supported along with the sway only bar <bar-id> mode <mode> syntax.

while the actual behavior is that `bar_cmd_mode` ignores already
selected `config->current_bar` and applies the change to all the
configured bars.
This commit is contained in:
Aleksei Bavshin 2021-11-22 20:52:19 -08:00 committed by Simon Ser
parent a23cdbbea1
commit 94dc486f0e
2 changed files with 2 additions and 2 deletions

View file

@ -54,7 +54,7 @@ struct cmd_results *bar_cmd_hidden_state(int argc, char **argv) {
} }
const char *state = argv[0]; const char *state = argv[0];
if (config->reading) { if (config->current_bar) {
error = bar_set_hidden_state(config->current_bar, state); error = bar_set_hidden_state(config->current_bar, state);
} else { } else {
const char *id = argc == 2 ? argv[1] : NULL; const char *id = argc == 2 ? argv[1] : NULL;

View file

@ -58,7 +58,7 @@ struct cmd_results *bar_cmd_mode(int argc, char **argv) {
} }
const char *mode = argv[0]; const char *mode = argv[0];
if (config->reading) { if (config->current_bar) {
error = bar_set_mode(config->current_bar, mode); error = bar_set_mode(config->current_bar, mode);
} else { } else {
const char *id = argc == 2 ? argv[1] : NULL; const char *id = argc == 2 ? argv[1] : NULL;