diff --git a/src/output.c b/src/output.c index f62dd87e..4533cab3 100644 --- a/src/output.c +++ b/src/output.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -195,6 +196,17 @@ handle_output_destroy(struct wl_listener *listener, void *data) */ output->wlr_output->data = NULL; + /* + * On nested backends (X11/Wayland), outputs correspond to + * windows and cannot be reconnected. Exit the compositor + * when the last one is destroyed. + */ + if (wl_list_empty(&server->outputs) + && (wlr_output_is_x11(output->wlr_output) + || wlr_output_is_wl(output->wlr_output))) { + wl_display_terminate(server->wl_display); + } + /* * output->scene_output (if still around at this point) is * destroyed automatically when the wlr_output is destroyed