aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-05-22 12:42:27 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-06-03 08:30:26 -0400
commit5c20c05acd772e00a1bc0e76cc22f055246e74ae (patch)
tree3b12c931a5a1c39029dc689cfddc4f4e134b5144
parentbar: fix segfault with missing or invalid bar id (diff)
downloadsway-5c20c05acd772e00a1bc0e76cc22f055246e74ae.tar.gz
sway-5c20c05acd772e00a1bc0e76cc22f055246e74ae.tar.zst
sway-5c20c05acd772e00a1bc0e76cc22f055246e74ae.zip
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) {
80 } 80 }
81 config->current_bar = bar; 81 config->current_bar = bar;
82 ++argv; --argc; 82 ++argv; --argc;
83 } else if (!config->reading && strcmp(argv[0], "mode") != 0 &&
84 strcmp(argv[0], "hidden_state") != 0) {
85 if (is_subcommand(argv[0])) {
86 return cmd_results_new(CMD_INVALID, "No bar defined.");
87 } else {
88 return cmd_results_new(CMD_INVALID,
89 "Unknown/invalid command '%s'", argv[1]);
90 }
83 } 91 }
84 92
85 if (!config->current_bar) { 93 if (!config->current_bar) {