[hackers] [slstatus][PATCH] Handle SIGUSR1 for forced refreshes

From: Mart Lubbers <mart_AT_martlubbers.net>
Date: Tue, 14 Jul 2020 14:45:14 +0200

Dear all,
I've submitted this patch before but maybe I did something wrong (it was before
the confirmation mail of the subscription). If there is anything else off with
this email/patch, please let me know.
Best,

Original email:

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

---
 slstatus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/slstatus.c b/slstatus.c
index 96fa5b6..499cd30 100644
--- a/slstatus.c
+++ b/slstatus.c
_AT_@ -26,9 +26,8 @@ static Display *dpy;
 static void
 terminate(const int signo)
 {
-       (void)signo;
-
-       done = 1;
+       if (signo != SIGUSR1)
+               done = 1;
 }
 static void
_AT_@ -72,6 +71,7 @@ main(int argc, char *argv[])
        act.sa_handler = terminate;
        sigaction(SIGINT,  &act, NULL);
        sigaction(SIGTERM, &act, NULL);
+       sigaction(SIGUSR1, &act, NULL);
        if (!sflag && !(dpy = XOpenDisplay(NULL))) {
                die("XOpenDisplay: Failed to open display");
--
2.20.1

Received on Tue Jul 14 2020 - 14:45:14 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 14 2020 - 14:48:32 CEST