My slstatus configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 line
420 B

  1. #include <err.h>
  2. #include <X11/Xlib.h>
  3. #include "util.h"
  4. const char *
  5. keyboard_indicators(void)
  6. {
  7. Display *dpy = XOpenDisplay(NULL);
  8. XKeyboardState state;
  9. if (dpy == NULL) {
  10. warnx("XOpenDisplay failed");
  11. return NULL;
  12. }
  13. XGetKeyboardControl(dpy, &state);
  14. XCloseDisplay(dpy);
  15. switch (state.led_mask) {
  16. case 1:
  17. return "c";
  18. case 2:
  19. return "n";
  20. case 3:
  21. return "cn";
  22. default:
  23. return "";
  24. }
  25. }