don't autostart when restarting; properly this time

This commit is contained in:
speedie 2023-01-07 23:10:17 +01:00
parent 65ffc61dd3
commit 738340050a

View file

@ -1010,6 +1010,16 @@ autostart_exec() {
const char *const *p;
size_t i = 0;
FILE *rsfile = fopen("/tmp/speedwm-isrestart", "r");
if (rsfile) {
/* delete autostart file and return */
if (remove("/tmp/speedwm-isrestart"))
fprintf(stderr, "speedwm: Failed to remove /tmp/speedwm-isrestart");
return;
}
/* count entries */
for (p = autostart; *p; autostart_len++, p++)
while (*++p);
@ -4365,8 +4375,20 @@ quit(const Arg *arg)
}
}
if(arg->i) restart = 1;
running = 0;
/* it will not be 0 because 0 means exit, not restart */
if (arg->i) {
restart = 1;
FILE *rsfile = fopen("/tmp/speedwm-isrestart", "w");
int ws = fputs("\n", rsfile);
if (ws)
fprintf(stderr, "speedwm: failed to write restart file.\n");
fclose(rsfile);
}
running = 0;
}
Client *
@ -6499,8 +6521,7 @@ main(int argc, char *argv[])
system("[ -e $HOME/.config/speedwm/speedwmrc ] && xrdb -override $HOME/.config/speedwm/speedwmrc");
/* autostart */
if (!restart)
autostart_exec();
autostart_exec();
/* load colors */
#if USEXRESOURCES