diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/main.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sway/main.c b/sway/main.c index 6e3f6b67..6e2f16db 100644 --- a/sway/main.c +++ b/sway/main.c @@ -31,10 +31,16 @@ static int exit_value = 0; struct sway_server server = {0}; void sway_terminate(int exit_code) { - terminate_request = true; - exit_value = exit_code; - ipc_event_shutdown("exit"); - wl_display_terminate(server.wl_display); + if (!server.wl_display) { + // Running as IPC client + exit(exit_code); + } else { + // Running as server + terminate_request = true; + exit_value = exit_code; + ipc_event_shutdown("exit"); + wl_display_terminate(server.wl_display); + } } void sig_handler(int signal) { |