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.

60 lines
1.4 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. const char *browse[] = { "firefox", NULL };
  13. static Key key[] = {
  14. { Mod1Mask, XK_Return, (void (*)(void *))spawn, term },
  15. { Mod1Mask, XK_w, (void (*)(void *))spawn, browse },
  16. { Mod1Mask, XK_k, sel, "prev" },
  17. { Mod1Mask, XK_j, sel, "next" },
  18. { Mod1Mask, XK_space, toggle, NULL },
  19. { Mod1Mask, XK_m, max, NULL },
  20. { Mod1Mask | ShiftMask, XK_c, ckill, NULL },
  21. { Mod1Mask | ShiftMask, XK_q, quit, NULL },
  22. };
  23. /********** CUSTOMIZE **********/
  24. void
  25. update_keys(void)
  26. {
  27. unsigned int i, len;
  28. KeyCode code;
  29. len = sizeof(key) / sizeof(key[0]);
  30. for(i = 0; i < len; i++) {
  31. code = XKeysymToKeycode(dpy, key[i].keysym);
  32. XUngrabKey(dpy, code, key[i].mod, root);
  33. XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync);
  34. }
  35. }
  36. void
  37. keypress(XEvent *e)
  38. {
  39. XKeyEvent *ev = &e->xkey;
  40. unsigned int i, len;
  41. KeySym keysym;
  42. keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
  43. len = sizeof(key) / sizeof(key[0]);
  44. for(i = 0; i < len; i++)
  45. if((keysym == key[i].keysym) && (key[i].mod == ev->state)) {
  46. if(key[i].func)
  47. key[i].func(key[i].aux);
  48. return;
  49. }
  50. }