commit: d64877b26ec2287b5d1b8176db81a15735159cec
parent: 7c59d8ac3aa2a1af0bf368261997ff9578f10b4a
author: Chris Noxz <chris@noxz.tech>
date: Wed, 14 Aug 2019 13:35:02 +0200
redraw st on signal
2 files changed, 15 insertions(+)
diff --git a/config.def.h b/config.def.h
@@ -8,6 +8,9 @@
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
static int borderpx = 2;
+/* redraw on signal */
+#define SIGREDRW SIGUSR1
+
/*
* What program is execed by st depends of these precedence rules:
* 1: program passed with -e
diff --git a/x.c b/x.c
@@ -727,6 +727,16 @@ xloadcolor(int i, const char *name, Color *ncolor)
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
}
+void
+redraw_signalhandler(int signum)
+{
+ if (signum == SIGREDRW) {
+ xloadcols();
+ redraw();
+ xhints();
+ }
+}
+
void
xloadcols(void)
{
@@ -734,6 +744,8 @@ xloadcols(void)
static int loaded;
Color *cp;
+ signal(SIGREDRW, &redraw_signalhandler);
+
if (loaded) {
for (cp = dc.col; cp < &dc.col[dc.collen]; ++cp)
XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);