summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slstatus.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/slstatus.c b/slstatus.c
index 47bd4c9..aa05cd1 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -380,9 +380,15 @@ kernel_release(void)
static const char *
keyboard_indicators(void)
{
+ Display *dpy = XOpenDisplay(NULL);
XKeyboardState state;
+ if (dpy == NULL) {
+ warnx("XOpenDisplay failed");
+ return UNKNOWN_STR;
+ }
XGetKeyboardControl(dpy, &state);
+ XCloseDisplay(dpy);
switch (state.led_mask) {
case 1: