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.
master
Aleksei Bavshin 3 years ago committed by Simon Ser
parent a23cdbbea1
commit 94dc486f0e

@ -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;

@ -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;

Loading…
Cancel
Save