Commit: f3a2b10b4831b4016abb0435b73b91f3db1e0bb5
Parent: 1081f135706c0fc7cb9b5685e44cc235029dfd3a
Author: Randy Palamar
Date: Tue, 16 Mar 2021 13:27:13 -0600
stop opening display when printing to stdout
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/status.c b/status.c
@@ -147,7 +147,7 @@ main(int argc, char *argv[])
}
}
- if (!(dpy = XOpenDisplay(NULL)))
+ if (!dflag && !(dpy = XOpenDisplay(NULL)))
die("XOpenDisplay: can't open display\n");
for (len = 0; !done; sleep(1), len = 0) {
@@ -166,8 +166,10 @@ main(int argc, char *argv[])
setstatus(status);
}
- XStoreName(dpy, DefaultRootWindow(dpy), NULL);
- XCloseDisplay(dpy);
+ if (!dflag) {
+ XStoreName(dpy, DefaultRootWindow(dpy), NULL);
+ XCloseDisplay(dpy);
+ }
return 0;
}