]> code.delx.au - spectrwm/commitdiff
Make HUP actually restart the wm. Comes in handy when you hang it;
authorMarco Peereboom <marco@conformal.com>
Sat, 3 Jul 2010 22:41:34 +0000 (22:41 +0000)
committerMarco Peereboom <marco@conformal.com>
Sat, 3 Jul 2010 22:41:34 +0000 (22:41 +0000)
what's bad is that I know how to do it...

scrotwm.c

index a8a4f31f2d6ef25a351cdccd6e0abf78761cd4c7..67ad17a4f6f3a201fd3209f58f8950c797484661 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -168,6 +168,7 @@ Atom                        aprot;
 Atom                   adelete;
 Atom                   takefocus;
 volatile sig_atomic_t   running = 1;
+volatile sig_atomic_t   restart_wm = 0;
 int                    outputs = 0;
 int                    last_focus_event = FocusOut;
 int                    (*xerrorxlib)(Display *, XErrorEvent *);
@@ -608,9 +609,11 @@ sighdlr(int sig)
                                break;
                }
                break;
+       case SIGHUP:
+               restart_wm = 1;
+               break;
        case SIGINT:
        case SIGTERM:
-       case SIGHUP:
        case SIGQUIT:
                running = 0;
                break;
@@ -4924,6 +4927,8 @@ main(int argc, char *argv[])
                if (select(xfd + 1, &rd, NULL, NULL, &tv) == -1)
                        if (errno != EINTR)
                                DNPRINTF(SWM_D_MISC, "select failed");
+               if (restart_wm == 1)
+                       restart(NULL, NULL);
                if (running == 0)
                        goto done;
                if (bar_alarm) {