Configuration of dwm for Mac Computers
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.

55 lines
1.3 KiB

  1. /*
  2. * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  3. * See LICENSE file for license details.
  4. */
  5. #include "wm.h"
  6. #include <X11/keysym.h>
  7. static const char *term[] = {
  8. "xterm", "-bg", "black", "-fg", "white", "-fn",
  9. "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", 0
  10. };
  11. static const char *proglist[] = {
  12. "sh", "-c", "exec `ls -lL /bin /sbin /usr/bin /usr/local/bin 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | gridmenu`", 0
  13. };
  14. static Key key[] = {
  15. { Mod1Mask, XK_Return, run, term },
  16. { Mod1Mask, XK_p, run, proglist },
  17. { Mod1Mask | ShiftMask, XK_c, kill, NULL},
  18. { Mod1Mask | ShiftMask, XK_q, quit, NULL},
  19. };
  20. void
  21. update_keys()
  22. {
  23. unsigned int i, len;
  24. KeyCode code;
  25. len = sizeof(key) / sizeof(key[0]);
  26. for(i = 0; i < len; i++) {
  27. code = XKeysymToKeycode(dpy, key[i].keysym);
  28. XUngrabKey(dpy, code, key[i].mod, root);
  29. XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync);
  30. }
  31. }
  32. void
  33. keypress(XEvent *e)
  34. {
  35. XKeyEvent *ev = &e->xkey;
  36. unsigned int i, len;
  37. KeySym keysym;
  38. keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
  39. len = sizeof(key) / sizeof(key[0]);
  40. for(i = 0; i < len; i++)
  41. if((keysym == key[i].keysym) && (key[i].mod == ev->state)) {
  42. if(key[i].func)
  43. key[i].func(key[i].aux);
  44. return;
  45. }
  46. }