dwm-meillo

view kb.c @ 32:082c75b937b5

removed unnecessary crap
author Anselm R. Garbe <garbeam@wmii.de>
date Thu, 13 Jul 2006 01:30:55 +0200
parents 386649deb651
children e90449e03167
line source
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
6 #include "wm.h"
8 #include <X11/keysym.h>
10 /********** CUSTOMIZE **********/
12 char *term[] = {
13 "aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
14 "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
15 };
17 static Key key[] = {
18 { Mod1Mask, XK_Return, run, term },
19 { Mod1Mask, XK_k, sel, "prev" },
20 { Mod1Mask, XK_j, sel, "next" },
21 { Mod1Mask, XK_g, grid, NULL },
22 { Mod1Mask, XK_f, floating, NULL },
23 { Mod1Mask, XK_m, max, NULL },
24 { Mod1Mask | ShiftMask, XK_c, ckill, NULL },
25 { Mod1Mask | ShiftMask, XK_q, quit, NULL },
26 };
28 /********** CUSTOMIZE **********/
30 void
31 update_keys()
32 {
33 unsigned int i, len;
34 KeyCode code;
36 len = sizeof(key) / sizeof(key[0]);
37 for(i = 0; i < len; i++) {
38 code = XKeysymToKeycode(dpy, key[i].keysym);
39 XUngrabKey(dpy, code, key[i].mod, root);
40 XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync);
41 }
42 }
44 void
45 keypress(XEvent *e)
46 {
47 XKeyEvent *ev = &e->xkey;
48 unsigned int i, len;
49 KeySym keysym;
51 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
52 len = sizeof(key) / sizeof(key[0]);
53 for(i = 0; i < len; i++)
54 if((keysym == key[i].keysym) && (key[i].mod == ev->state)) {
55 if(key[i].func)
56 key[i].func(key[i].aux);
57 return;
58 }
59 }