At some point one might want to force a refresh for example after
checking email or changing the volume. Sending a SIGUSR1 achieves this
now
};
char buf[1024];
-static int done;
+static volatile sig_atomic_t done;
static Display *dpy;
#include "config.h"
static void
terminate(const int signo)
{
- (void)signo;
-
- done = 1;
+ if (signo != SIGUSR1)
+ done = 1;
}
static void
act.sa_handler = terminate;
sigaction(SIGINT, &act, NULL);
sigaction(SIGTERM, &act, NULL);
+ act.sa_flags |= SA_RESTART;
+ sigaction(SIGUSR1, &act, NULL);
if (!sflag && !(dpy = XOpenDisplay(NULL))) {
die("XOpenDisplay: Failed to open display");