summaryrefslogtreecommitdiff
path: root/slstatus.c
diff options
context:
space:
mode:
authorAaron Marcher <info@nulltime.net>2017-01-16 12:10:56 +0100
committerAaron Marcher <info@nulltime.net>2017-01-16 12:10:56 +0100
commit823f2d047f9f14c5e401c337274c8c19542b3065 (patch)
tree2b8587f0bc02804027e511a673500eb4829a0b3c /slstatus.c
parent3f976aabc08dd7d4762b0e04f0cbe8550f0e3ced (diff)
Added keyboard_indicators (Fixes #31)
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];