summaryrefslogtreecommitdiff
path: root/slstatus.c
diff options
context:
space:
mode:
Diffstat (limited to 'slstatus.c')
-rw-r--r--slstatus.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/slstatus.c b/slstatus.c
index 89186d6..d29436d 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -47,6 +47,7 @@ static char *gid(void);
static char *hostname(void);
static char *ip(const char *iface);
static char *kernel_release(void);
+static char *keyboard_indicators(void);
static char *load_avg(void);
static char *ram_free(void);
static char *ram_perc(void);
@@ -323,6 +324,30 @@ kernel_release(void)
}
static char *
+keyboard_indicators(void)
+{
+ Display *dpy = XOpenDisplay(NULL);
+ XKeyboardState state;
+ XGetKeyboardControl(dpy, &state);
+
+ switch (state.led_mask) {
+ case 1:
+ return smprintf("c");
+ break;
+ case 2:
+ return smprintf("n");
+ break;
+ case 3:
+ return smprintf("cn");
+ break;
+ default:
+ return smprintf("");
+ }
+
+ XCloseDisplay(dpy);
+}
+
+static char *
load_avg(void)
{
double avgs[3];