diff options
author | Aaron Marcher <info@nulltime.net> | 2017-01-16 12:10:56 +0100 |
---|---|---|
committer | Aaron Marcher <info@nulltime.net> | 2017-01-16 12:10:56 +0100 |
commit | 823f2d047f9f14c5e401c337274c8c19542b3065 (patch) | |
tree | 2b8587f0bc02804027e511a673500eb4829a0b3c /slstatus.c | |
parent | 3f976aabc08dd7d4762b0e04f0cbe8550f0e3ced (diff) |
Added keyboard_indicators (Fixes #31)
Diffstat (limited to 'slstatus.c')
-rw-r--r-- | slstatus.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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]; |