diff --git a/speedwm.c b/speedwm.c index e9f07d6..e7b69d7 100644 --- a/speedwm.c +++ b/speedwm.c @@ -4379,6 +4379,7 @@ quit(const Arg *arg) Monitor *m; Client *c; + size_t i; for (m = mons; m; m = m->next) { if (m) { @@ -4387,6 +4388,14 @@ quit(const Arg *arg) } } + /* kill child processes */ + for (i = 0; i < autostart_len; i++) { + if (0 < autostart_pids[i]) { + kill(autostart_pids[i], SIGTERM); + waitpid(autostart_pids[i], NULL, 0); + } + } + if(arg->i) restart = 1; running = 0; } @@ -6532,6 +6541,7 @@ main(int argc, char *argv[]) } if (!(xcon = XGetXCBConnection(dpy))) die("speedwm: Cannot get xcb connection\n"); + if (!restart) autostart_exec(); checkotherwm(); XrmInitialize(); #if USEXRESOURCES @@ -6544,11 +6554,8 @@ main(int argc, char *argv[]) #endif /* __OpenBSD__ */ scan(); run(); - if(restart) { + if (restart) execvp(argv[0], argv); - } else { - autostart_exec(); - } cleanup(); XCloseDisplay(dpy); return EXIT_SUCCESS;