diff options
| -rw-r--r-- | config.def.h | 2 | ||||
| -rw-r--r-- | dwm.c | 24 |
2 files changed, 11 insertions, 15 deletions
diff --git a/config.def.h b/config.def.h index 8e68937..aa79412 100644 --- a/config.def.h +++ b/config.def.h @@ -100,7 +100,7 @@ static int fakefsindicatortype = INDICATOR_PLUS; static int floatfakefsindicatortype = INDICATOR_PLUS_AND_LARGER_SQUARE; #endif // FAKEFULLSCREEN_CLIENT_PATCH #if ONLYQUITONEMPTY_PATCH -static const int quit_empty_window_count = 2; /* only allow dwm to quit if no windows are open, value here represents number of deamons */ +static const int quit_empty_window_count = 0; /* only allow dwm to quit if no (<= count) windows are open */ #endif // ONLYQUITONEMPTY_PATCH #if BAR_EXTRASTATUS_PATCH static const char statussep = ';'; /* separator between status bars */ @@ -2744,27 +2744,23 @@ quit(const Arg *arg) #if COOL_AUTOSTART_PATCH size_t i; #endif // COOL_AUTOSTART_PATCH + #if RESTARTSIG_PATCH + restart = arg->i; + #endif // RESTARTSIG_PATCH #if ONLYQUITONEMPTY_PATCH - unsigned int n; - Window *junk = malloc(1); + Monitor *m; + Client *c; + unsigned int n = 0; - XQueryTree(dpy, root, junk, junk, &junk, &n); + for (m = mons; m; m = m->next) + for (c = m->clients; c; c = c->next, n++); - if (n <= quit_empty_window_count) - { - #if RESTARTSIG_PATCH - restart = arg->i; - #endif // RESTARTSIG_PATCH + if (restart || n <= quit_empty_window_count) running = 0; - } else - printf("[dwm] not exiting (n=%d)\n", n); + fprintf(stderr, "[dwm] not exiting (n=%d)\n", n); - free(junk); #else // !ONLYQUITONEMPTY_PATCH - #if RESTARTSIG_PATCH - restart = arg->i; - #endif // RESTARTSIG_PATCH running = 0; #endif // ONLYQUITONEMPTY_PATCH |
