summaryrefslogtreecommitdiffstats
path: root/swaylock
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-15 21:57:59 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-15 21:57:59 +1000
commit32ba8154b8f5f15b2c778dd404f3acb5becc1719 (patch)
tree82800feb0bf4b5b96aa5d7f69a38c09be5676a32 /swaylock
parentMerge pull request #2831 from swaywm/move-output-docs (diff)
downloadsway-32ba8154b8f5f15b2c778dd404f3acb5becc1719.tar.gz
sway-32ba8154b8f5f15b2c778dd404f3acb5becc1719.tar.zst
sway-32ba8154b8f5f15b2c778dd404f3acb5becc1719.zip
Sway clients: Exit gracefully when compositor is unavailable
Diffstat (limited to 'swaylock')
-rw-r--r--swaylock/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 27bcfe32..04c0bb07 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -908,7 +908,11 @@ int main(int argc, char **argv) {
908 wl_list_init(&state.surfaces); 908 wl_list_init(&state.surfaces);
909 state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); 909 state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
910 state.display = wl_display_connect(NULL); 910 state.display = wl_display_connect(NULL);
911 assert(state.display); 911 if (!state.display) {
912 sway_abort("Unable to connect to the compositor. "
913 "If your compositor is running, check or set the "
914 "WAYLAND_DISPLAY environment variable.");
915 }
912 916
913 struct wl_registry *registry = wl_display_get_registry(state.display); 917 struct wl_registry *registry = wl_display_get_registry(state.display);
914 wl_registry_add_listener(registry, &registry_listener, &state); 918 wl_registry_add_listener(registry, &registry_listener, &state);