Handle SIGUSR1 for forced refreshes
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
This commit is contained in:
parent
3fc2872d1b
commit
d1b23e5509
1 changed files with 5 additions and 4 deletions
|
@ -18,7 +18,7 @@ struct arg {
|
||||||
};
|
};
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
static int done;
|
static volatile sig_atomic_t done;
|
||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -26,9 +26,8 @@ static Display *dpy;
|
||||||
static void
|
static void
|
||||||
terminate(const int signo)
|
terminate(const int signo)
|
||||||
{
|
{
|
||||||
(void)signo;
|
if (signo != SIGUSR1)
|
||||||
|
done = 1;
|
||||||
done = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -72,6 +71,8 @@ main(int argc, char *argv[])
|
||||||
act.sa_handler = terminate;
|
act.sa_handler = terminate;
|
||||||
sigaction(SIGINT, &act, NULL);
|
sigaction(SIGINT, &act, NULL);
|
||||||
sigaction(SIGTERM, &act, NULL);
|
sigaction(SIGTERM, &act, NULL);
|
||||||
|
act.sa_flags |= SA_RESTART;
|
||||||
|
sigaction(SIGUSR1, &act, NULL);
|
||||||
|
|
||||||
if (!sflag && !(dpy = XOpenDisplay(NULL))) {
|
if (!sflag && !(dpy = XOpenDisplay(NULL))) {
|
||||||
die("XOpenDisplay: Failed to open display");
|
die("XOpenDisplay: Failed to open display");
|
||||||
|
|
Loading…
Reference in a new issue