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.

59 lines
1.3 KiB

18 years ago
  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. /********** CUSTOMIZE **********/
  8. const char *term[] = {
  9. "aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
  10. "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
  11. };
  12. static Key key[] = {
  13. { Mod1Mask, XK_Return, (void (*)(void *))spawn, term },
  14. { Mod1Mask, XK_k, sel, "prev" },
  15. { Mod1Mask, XK_j, sel, "next" },
  16. { Mod1Mask, XK_g, grid, NULL },
  17. { Mod1Mask, XK_f, floating, NULL },
  18. { Mod1Mask, XK_m, max, NULL },
  19. { Mod1Mask | ShiftMask, XK_c, ckill, NULL },
  20. { Mod1Mask | ShiftMask, XK_q, quit, NULL },
  21. };
  22. /********** CUSTOMIZE **********/
  23. void
  24. update_keys(void)
  25. {
  26. unsigned int i, len;
  27. KeyCode code;
  28. len = sizeof(key) / sizeof(key[0]);
  29. for(i = 0; i < len; i++) {
  30. code = XKeysymToKeycode(dpy, key[i].keysym);
  31. XUngrabKey(dpy, code, key[i].mod, root);
  32. XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync);
  33. }
  34. }
  35. void
  36. keypress(XEvent *e)
  37. {
  38. XKeyEvent *ev = &e->xkey;
  39. unsigned int i, len;
  40. KeySym keysym;
  41. keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
  42. len = sizeof(key) / sizeof(key[0]);
  43. for(i = 0; i < len; i++)
  44. if((keysym == key[i].keysym) && (key[i].mod == ev->state)) {
  45. if(key[i].func)
  46. key[i].func(key[i].aux);
  47. return;
  48. }
  49. }