wmclockmon: import version 0.8.0
[dockapps.git] / cnslock / kleds.c
blobda235331e161421986e13a60c5db5e4610efa7f8
1 /*
2 This code is based upon some lines(actually two lines :-)
3 in E-Leds by Mathias Meisfjordskar<mathiasm@ifi.uio.no>
4 Released under GPL.
5 */
7 #include <stdio.h>
8 #include <X11/XKBlib.h>
9 #include <libdockapp/dockapp.h>
11 #include "include/kleds.h"
14 Returns the turned on leds:
15 Bit 0 is Capslock
16 Bit 1 is Numlock
17 Bit 2 is Scrollock
20 int check_kleds()
22 unsigned int states;
24 if (XkbGetIndicatorState(DADisplay, XkbUseCoreKbd, &states) != Success)
26 perror("Error while reading Indicator status\n");
27 return -1;
29 return (states & 0x7);