aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2022-08-09 17:11:28 +0000
committerGitHub <noreply@github.com>2022-08-09 17:11:28 +0000
commitf80e66cc3898f89c394490cd35921b9eb68db842 (patch)
tree7727303673af37591a68dabcf5b7cf32d62e9597
parentMerge branch 'dfuehrer-fastscroll_fix' (diff)
parentDo not block interrupt/terminate signals (diff)
downloaddwmblocks-f80e66cc3898f89c394490cd35921b9eb68db842.tar.gz
dwmblocks-f80e66cc3898f89c394490cd35921b9eb68db842.tar.bz2
dwmblocks-f80e66cc3898f89c394490cd35921b9eb68db842.tar.xz
dwmblocks-f80e66cc3898f89c394490cd35921b9eb68db842.tar.zst
dwmblocks-f80e66cc3898f89c394490cd35921b9eb68db842.zip
Merge pull request #104 from ethanv2/freeze
Fix statusbar freezing
-rw-r--r--dwmblocks.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/dwmblocks.c b/dwmblocks.c
index 0969ed7..fb56d95 100644
--- a/dwmblocks.c
+++ b/dwmblocks.c
@@ -183,6 +183,17 @@ int getstatus(char *str, char *last)
void setroot()
{
+ /* block all signals until after root updated */
+ sigset_t new, old;
+ sigfillset(&new);
+ sigdelset(&new, SIGINT);
+ sigdelset(&new, SIGTERM);
+
+ if (sigprocmask(SIG_SETMASK, &new, &old) < 0) {
+ perror("sigset");
+ exit(1);
+ }
+
if (!getstatus(statusstr[0], statusstr[1]))//Only set root if text has changed.
return;
Display *d = XOpenDisplay(NULL);
@@ -192,7 +203,10 @@ void setroot()
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
XStoreName(dpy, root, statusstr[0]);
- XCloseDisplay(dpy);
+ XCloseDisplay(d);
+
+ /* restore signals to default */
+ sigprocmask(SIG_SETMASK, &old, NULL);
}
void pstdout()