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.
 
 
 
 

31 lines
482 B

  1. /* See LICENSE file for copyright and license details. */
  2. #include <stdio.h>
  3. #include <X11/Xlib.h>
  4. #include "../util.h"
  5. const char *
  6. keyboard_indicators(void)
  7. {
  8. Display *dpy;
  9. XKeyboardState state;
  10. if (!(dpy = XOpenDisplay(NULL))) {
  11. fprintf(stderr, "Cannot open display\n");
  12. return NULL;
  13. }
  14. XGetKeyboardControl(dpy, &state);
  15. XCloseDisplay(dpy);
  16. switch (state.led_mask) {
  17. case 1:
  18. return "c";
  19. case 2:
  20. return "n";
  21. case 3:
  22. return "cn";
  23. default:
  24. return "";
  25. }
  26. }