My slstatus configuration
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

keyboard_indicators.c 420 B

1234567891011121314151617181920212223242526272829
  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. }