From 32ba8154b8f5f15b2c778dd404f3acb5becc1719 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 15 Oct 2018 21:57:59 +1000 Subject: Sway clients: Exit gracefully when compositor is unavailable --- swaybar/bar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'swaybar/bar.c') diff --git a/swaybar/bar.c b/swaybar/bar.c index be290c18..0deba72d 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -586,7 +586,11 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) { } bar->display = wl_display_connect(NULL); - assert(bar->display); + if (!bar->display) { + sway_abort("Unable to connect to the compositor. " + "If your compositor is running, check or set the " + "WAYLAND_DISPLAY environment variable."); + } struct wl_registry *registry = wl_display_get_registry(bar->display); wl_registry_add_listener(registry, ®istry_listener, bar); -- cgit v1.2.3