From ec6a64a64fd957ce10b04834f30cf3270c849309 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Mon, 25 Oct 2021 15:43:14 +0200 Subject: [PATCH] onlyquitonempty + cool_autostart: adding proposed compatibility improvements ref. #194 --- dwm.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/dwm.c b/dwm.c index 8457fce..2bd28e6 100644 --- a/dwm.c +++ b/dwm.c @@ -2750,15 +2750,10 @@ quit(const Arg *arg) XQueryTree(dpy, root, junk, junk, &junk, &n); - #if COOL_AUTOSTART_PATCH - if (n - autostart_len <= quit_empty_window_count) - #else if (n <= quit_empty_window_count) - #endif // COOL_AUTOSTART_PATCH { #if RESTARTSIG_PATCH - if (arg->i) - restart = 1; + restart = arg->i; #endif // RESTARTSIG_PATCH running = 0; } @@ -2766,17 +2761,16 @@ quit(const Arg *arg) printf("[dwm] not exiting (n=%d)\n", n); free(junk); - #else + #else // !ONLYQUITONEMPTY_PATCH #if RESTARTSIG_PATCH - if (arg->i) - restart = 1; + restart = arg->i; #endif // RESTARTSIG_PATCH running = 0; #endif // ONLYQUITONEMPTY_PATCH #if COOL_AUTOSTART_PATCH /* kill child processes */ - for (i = 0; i < autostart_len; i++) { + for (i = 0; i < autostart_len && !running; i++) { if (0 < autostart_pids[i]) { kill(autostart_pids[i], SIGTERM); waitpid(autostart_pids[i], NULL, 0);