summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2019-05-22 12:42:27 -0400
committerFurkan Sahin <furkan-dev@proton.me>2019-05-22 12:42:27 -0400
commitc38dbb70b183d09b75297052486f885d2c29dcbe (patch)
tree3b12c931a5a1c39029dc689cfddc4f4e134b5144
parent336b929377d338e7a2a89607e8f8fb645c5b8bb8 (diff)
commands/bar: fix mode and hidden_state at runtime
For compatibility with i3, `bar mode` and `bar hidden_state` do not require bar-ids (in the normal location) at runtime since they follow the alternative syntax: `bar mode|hidden_state <option> [<bar-id>]` This removes the incorrect error that the bar-id is missing for those two bar subcommands
-rw-r--r--sway/commands/bar.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sway/commands/bar.c b/sway/commands/bar.c
index 9c7357dd..28699d7d 100644
--- a/sway/commands/bar.c
+++ b/sway/commands/bar.c
@@ -80,6 +80,14 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
}
config->current_bar = bar;
++argv; --argc;
+ } else if (!config->reading && strcmp(argv[0], "mode") != 0 &&
+ strcmp(argv[0], "hidden_state") != 0) {
+ if (is_subcommand(argv[0])) {
+ return cmd_results_new(CMD_INVALID, "No bar defined.");
+ } else {
+ return cmd_results_new(CMD_INVALID,
+ "Unknown/invalid command '%s'", argv[1]);
+ }
}
if (!config->current_bar) {