From 7f6d39d70c7f193461193ef866dbfdd30f541e45 Mon Sep 17 00:00:00 2001 From: speedie Date: Tue, 13 Dec 2022 21:36:03 +0100 Subject: [PATCH] don't load autostart entries when restarting --- speedwm.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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;