aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/main.c
diff options
context:
space:
mode:
authorLibravatar Kevin Hamacher <kevin.hamacher@rub.de>2015-12-16 11:13:12 +0100
committerLibravatar Kevin Hamacher <kevin.hamacher@rub.de>2015-12-16 11:13:12 +0100
commitce8b71415fbff64fb0d84f2032f4d2d5348a545e (patch)
tree8ca1c374e7f47af150cbb719b2003052865b0caa /swaybar/main.c
parentApply color config from swaybar (diff)
downloadsway-ce8b71415fbff64fb0d84f2032f4d2d5348a545e.tar.gz
sway-ce8b71415fbff64fb0d84f2032f4d2d5348a545e.tar.zst
sway-ce8b71415fbff64fb0d84f2032f4d2d5348a545e.zip
Make swaybar check command arguments
Diffstat (limited to 'swaybar/main.c')
-rw-r--r--swaybar/main.c8
1 files changed, 8 insertions, 0 deletions
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) {
368 } 368 }
369 } 369 }
370 370
371 if (!bar_id) {
372 sway_abort("No bar_id passed. Provide --bar_id or let sway start swaybar");
373 }
374
371 registry = registry_poll(); 375 registry = registry_poll();
372 376
373 if (!registry->desktop_shell) { 377 if (!registry->desktop_shell) {
@@ -382,6 +386,10 @@ int main(int argc, char **argv) {
382 } 386 }
383 socketfd = ipc_open_socket(socket_path); 387 socketfd = ipc_open_socket(socket_path);
384 388
389 if (argc == optind) {
390 sway_abort("No output index provided");
391 }
392
385 int desired_output = atoi(argv[optind]); 393 int desired_output = atoi(argv[optind]);
386 sway_log(L_INFO, "Using output %d of %d", desired_output, registry->outputs->length); 394 sway_log(L_INFO, "Using output %d of %d", desired_output, registry->outputs->length);
387 struct output_state *output = registry->outputs->items[desired_output]; 395 struct output_state *output = registry->outputs->items[desired_output];