diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-29 08:22:32 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-29 08:22:32 -0500 |
commit | 5292860b9202336d721089ecc9b0f3906aa47a33 (patch) | |
tree | 2ff85443a9587546176620d722028af59388d0da /sway/main.c | |
parent | d409620a55c0552d47a75502a35e7c8bde60685d (diff) | |
parent | 16b8c2e915fb7972ad5190ae2591b2d71789f477 (diff) |
Merge pull request #418 from mikkeloscar/sway-handle-sigterm
Handle SIGTERM sent to sway
Diffstat (limited to 'sway/main.c')
-rw-r--r-- | sway/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sway/main.c b/sway/main.c index 382e7ca2..37681f2d 100644 --- a/sway/main.c +++ b/sway/main.c @@ -26,6 +26,11 @@ void sway_terminate(void) { wlc_terminate(); } +void sig_handler(int signal) { + close_views(&root_container); + sway_terminate(); +} + static void wlc_log_handler(enum wlc_log_type type, const char *str) { if (type == WLC_LOG_ERROR) { sway_log(L_ERROR, "[wlc] %s", str); @@ -176,6 +181,9 @@ int main(int argc, char **argv) { } register_extensions(); + // handle SIGTERM signals + signal(SIGTERM, sig_handler); + #if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); #endif |