Move components into dedicated subdirectory
This brings us a lot more tidiness.
This commit is contained in:

committed by
Aaron Marcher

parent
61e44e8948
commit
7246dc4381
30
components/keyboard_indicators.c
Normal file
30
components/keyboard_indicators.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <err.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "../util.h"
|
||||
|
||||
const char *
|
||||
keyboard_indicators(void)
|
||||
{
|
||||
Display *dpy = XOpenDisplay(NULL);
|
||||
XKeyboardState state;
|
||||
|
||||
if (dpy == NULL) {
|
||||
warnx("XOpenDisplay failed");
|
||||
return NULL;
|
||||
}
|
||||
XGetKeyboardControl(dpy, &state);
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
switch (state.led_mask) {
|
||||
case 1:
|
||||
return "c";
|
||||
case 2:
|
||||
return "n";
|
||||
case 3:
|
||||
return "cn";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user