From ce8b71415fbff64fb0d84f2032f4d2d5348a545e Mon Sep 17 00:00:00 2001 From: Kevin Hamacher Date: Wed, 16 Dec 2015 11:13:12 +0100 Subject: Make swaybar check command arguments --- swaybar/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'swaybar') diff --git a/swaybar/main.c b/swaybar/main.c index 21a8d292..3d817f86 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -368,6 +368,10 @@ int main(int argc, char **argv) { } } + if (!bar_id) { + sway_abort("No bar_id passed. Provide --bar_id or let sway start swaybar"); + } + registry = registry_poll(); if (!registry->desktop_shell) { @@ -382,6 +386,10 @@ int main(int argc, char **argv) { } socketfd = ipc_open_socket(socket_path); + if (argc == optind) { + sway_abort("No output index provided"); + } + int desired_output = atoi(argv[optind]); sway_log(L_INFO, "Using output %d of %d", desired_output, registry->outputs->length); struct output_state *output = registry->outputs->items[desired_output]; -- cgit v1.2.3