summaryrefslogtreecommitdiffhomepage
path: root/dwm.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2022-07-11 11:04:01 +0200
committerbakkeby <[email protected]>2022-07-11 11:04:01 +0200
commitd4ab4400ac4ac0744341113f7329614403c8fcb4 (patch)
treec26fe18ded5fe853692bb217d13dc3e26736ee3d /dwm.c
parent5f7df0b0dc78ae00f21d5bbe892456c450506b9b (diff)
downloaddwm-flexipatch-d4ab4400ac4ac0744341113f7329614403c8fcb4.tar.gz
dwm-flexipatch-d4ab4400ac4ac0744341113f7329614403c8fcb4.zip
restartsig and cool autostart: moving functionality to the cleanup function ref. #276
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/dwm.c b/dwm.c
index 1c77a15..326bdfc 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1233,15 +1233,27 @@ checkotherwm(void)
void
cleanup(void)
{
- #if !SEAMLESS_RESTART_PATCH
- Arg a = {.ui = ~0};
- #endif // SEAMLESS_RESTART_PATCH
- Layout foo = { "", NULL };
Monitor *m;
+ Layout foo = { "", NULL };
size_t i;
- #if !SEAMLESS_RESTART_PATCH
- view(&a);
+
+ #if SEAMLESS_RESTART_PATCH
+ for (m = mons; m; m = m->next)
+ persistmonitorstate(m);
+ #else
+ Arg a = {.ui = ~0};
#endif // SEAMLESS_RESTART_PATCH
+
+ #if COOL_AUTOSTART_PATCH
+ /* 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);
+ }
+ }
+ #endif // COOL_AUTOSTART_PATCH
+
selmon->lt[selmon->sellt] = &foo;
for (m = mons; m; m = m->next)
while (m->stack)
@@ -2856,19 +2868,11 @@ propertynotify(XEvent *e)
void
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 SEAMLESS_RESTART_PATCH
- Monitor *m;
- #endif // SEAMLESS_RESTART_PATCH
#if ONLYQUITONEMPTY_PATCH
- #if !SEAMLESS_RESTART_PATCH
Monitor *m;
- #endif // SEAMLESS_RESTART_PATCH
Client *c;
unsigned int n = 0;
@@ -2887,21 +2891,6 @@ quit(const Arg *arg)
#else // !ONLYQUITONEMPTY_PATCH
running = 0;
#endif // ONLYQUITONEMPTY_PATCH
-
- #if SEAMLESS_RESTART_PATCH
- for (m = mons; m && !running; m = m->next)
- persistmonitorstate(m);
- #endif // SEAMLESS_RESTART_PATCH
-
- #if COOL_AUTOSTART_PATCH
- /* kill child processes */
- for (i = 0; i < autostart_len && !running; i++) {
- if (0 < autostart_pids[i]) {
- kill(autostart_pids[i], SIGTERM);
- waitpid(autostart_pids[i], NULL, 0);
- }
- }
- #endif // COOL_AUTOSTART_PATCH
}
Monitor *