Mercurial > dwm-meillo
annotate kb.c @ 31:386649deb651
before leaning things up
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Thu, 13 Jul 2006 01:04:38 +0200 |
parents | 8ad86d0a6a53 |
children | 082c75b937b5 |
rev | line source |
---|---|
8 | 1 /* |
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> | |
3 * See LICENSE file for license details. | |
4 */ | |
5 | |
6 #include "wm.h" | |
7 | |
8 #include <X11/keysym.h> | |
9 | |
31 | 10 /********** CUSTOMIZE **********/ |
11 | |
12 char *cmdterm[] = { | |
29 | 13 "aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn", |
31 | 14 "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL |
14 | 15 }; |
16 | |
31 | 17 char *cmdproglist[] = { |
27
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
18 "sh", "-c", "exec `ls -lL /bin /sbin /usr/bin /usr/local/bin 2>/dev/null " |
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
19 "| awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | gridmenu`", 0 |
14 | 20 }; |
21 | |
8 | 22 static Key key[] = { |
31 | 23 { Mod1Mask, XK_Return, run, cmdterm }, |
24 { Mod1Mask, XK_p, run, cmdproglist}, | |
27
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
25 { Mod1Mask, XK_k, sel, "prev" }, |
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
26 { Mod1Mask, XK_j, sel, "next" }, |
31 | 27 { Mod1Mask, XK_g, grid, NULL }, |
28 { Mod1Mask, XK_f, floating, NULL }, | |
28 | 29 { Mod1Mask, XK_m, max, NULL }, |
27
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
30 { Mod1Mask | ShiftMask, XK_c, kill, NULL }, |
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
31 { Mod1Mask | ShiftMask, XK_q, quit, NULL }, |
8 | 32 }; |
33 | |
31 | 34 /********** CUSTOMIZE **********/ |
35 | |
8 | 36 void |
37 update_keys() | |
38 { | |
39 unsigned int i, len; | |
40 KeyCode code; | |
41 | |
42 len = sizeof(key) / sizeof(key[0]); | |
43 for(i = 0; i < len; i++) { | |
44 code = XKeysymToKeycode(dpy, key[i].keysym); | |
45 XUngrabKey(dpy, code, key[i].mod, root); | |
46 XGrabKey(dpy, code, key[i].mod, root, True, GrabModeAsync, GrabModeAsync); | |
47 } | |
48 } | |
9
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
49 |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
50 void |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
51 keypress(XEvent *e) |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
52 { |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
53 XKeyEvent *ev = &e->xkey; |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
54 unsigned int i, len; |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
55 KeySym keysym; |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
56 |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
57 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
58 len = sizeof(key) / sizeof(key[0]); |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
59 for(i = 0; i < len; i++) |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
60 if((keysym == key[i].keysym) && (key[i].mod == ev->state)) { |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
61 if(key[i].func) |
14 | 62 key[i].func(key[i].aux); |
9
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
63 return; |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
64 } |
d567f430a81d
fixed several stuff (gridwm gets better and better)
Anselm R. Garbe <garbeam@wmii.de>
parents:
8
diff
changeset
|
65 } |