Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-keycodes-6.1.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-keycodes-6.1.diff (6731B)
---
1 diff --git a/config.def.h b/config.def.h
2 index 7054c06..f59d1eb 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -58,40 +58,40 @@ static const char *dmenucmd[] = { "dmenu_run", "-m",…
6 static const char *termcmd[] = { "st", NULL };
7
8 static Key keys[] = {
9 - /* modifier key function argu…
10 - { MODKEY, XK_p, spawn, {.v …
11 - { MODKEY|ShiftMask, XK_Return, spawn, {.v …
12 - { MODKEY, XK_b, togglebar, {0} …
13 - { MODKEY, XK_j, focusstack, {.i …
14 - { MODKEY, XK_k, focusstack, {.i …
15 - { MODKEY, XK_i, incnmaster, {.i …
16 - { MODKEY, XK_d, incnmaster, {.i …
17 - { MODKEY, XK_h, setmfact, {.f …
18 - { MODKEY, XK_l, setmfact, {.f …
19 - { MODKEY, XK_Return, zoom, {0} …
20 - { MODKEY, XK_Tab, view, {0} …
21 - { MODKEY|ShiftMask, XK_c, killclient, {0} …
22 - { MODKEY, XK_t, setlayout, {.v …
23 - { MODKEY, XK_f, setlayout, {.v …
24 - { MODKEY, XK_m, setlayout, {.v …
25 - { MODKEY, XK_space, setlayout, {0} …
26 - { MODKEY|ShiftMask, XK_space, togglefloating, {0} …
27 - { MODKEY, XK_0, view, {.ui…
28 - { MODKEY|ShiftMask, XK_0, tag, {.ui…
29 - { MODKEY, XK_comma, focusmon, {.i …
30 - { MODKEY, XK_period, focusmon, {.i …
31 - { MODKEY|ShiftMask, XK_comma, tagmon, {.i …
32 - { MODKEY|ShiftMask, XK_period, tagmon, {.i …
33 - TAGKEYS( XK_1, 0)
34 - TAGKEYS( XK_2, 1)
35 - TAGKEYS( XK_3, 2)
36 - TAGKEYS( XK_4, 3)
37 - TAGKEYS( XK_5, 4)
38 - TAGKEYS( XK_6, 5)
39 - TAGKEYS( XK_7, 6)
40 - TAGKEYS( XK_8, 7)
41 - TAGKEYS( XK_9, 8)
42 - { MODKEY|ShiftMask, XK_q, quit, {0} …
43 + /* modifier key function argument */
44 + { MODKEY, 33, spawn, {.v = dmenucmd }…
45 + { MODKEY|ShiftMask, 36, spawn, {.v = termcmd } …
46 + { MODKEY, 56, togglebar, {0} }, …
47 + { MODKEY, 44, focusstack, {.i = +1 } }, …
48 + { MODKEY, 45, focusstack, {.i = -1 } }, …
49 + { MODKEY, 31, incnmaster, {.i = +1 } }, …
50 + { MODKEY, 40, incnmaster, {.i = -1 } }, …
51 + { MODKEY, 43, setmfact, {.f = -0.05} }, …
52 + { MODKEY, 46, setmfact, {.f = +0.05} }, …
53 + { MODKEY, 36, zoom, {0} }, …
54 + { MODKEY, 23, view, {0} }, …
55 + { MODKEY|ShiftMask, 54, killclient, {0} }, …
56 + { MODKEY, 28, setlayout, {.v = &layouts[0…
57 + { MODKEY, 41, setlayout, {.v = &layouts[1…
58 + { MODKEY, 58, setlayout, {.v = &layouts[2…
59 + { MODKEY, 65, setlayout, {0} }, …
60 + { MODKEY|ShiftMask, 65, togglefloating, {0} }, …
61 + { MODKEY, 19, view, {.ui = ~0 } }, …
62 + { MODKEY|ShiftMask, 19, tag, {.ui = ~0 } }, …
63 + { MODKEY, 59, focusmon, {.i = -1 } }, …
64 + { MODKEY, 60, focusmon, {.i = +1 } }, …
65 + { MODKEY|ShiftMask, 59, tagmon, {.i = -1 } }, …
66 + { MODKEY|ShiftMask, 60, tagmon, {.i = +1 } }, …
67 + TAGKEYS( 10, 0) …
68 + TAGKEYS( 11, 1) …
69 + TAGKEYS( 12, 2) …
70 + TAGKEYS( 13, 3) …
71 + TAGKEYS( 14, 4) …
72 + TAGKEYS( 15, 5) …
73 + TAGKEYS( 16, 6) …
74 + TAGKEYS( 17, 7) …
75 + TAGKEYS( 18, 8) …
76 + { MODKEY|ShiftMask, 24, quit, {0} }, …
77 };
78
79 /* button definitions */
80 diff --git a/dwm.c b/dwm.c
81 index 0362114..60dd817 100644
82 --- a/dwm.c
83 +++ b/dwm.c
84 @@ -31,7 +31,6 @@
85 #include <sys/types.h>
86 #include <sys/wait.h>
87 #include <X11/cursorfont.h>
88 -#include <X11/keysym.h>
89 #include <X11/Xatom.h>
90 #include <X11/Xlib.h>
91 #include <X11/Xproto.h>
92 @@ -101,7 +100,7 @@ struct Client {
93
94 typedef struct {
95 unsigned int mod;
96 - KeySym keysym;
97 + KeyCode keycode;
98 void (*func)(const Arg *);
99 const Arg arg;
100 } Key;
101 @@ -967,14 +966,12 @@ grabkeys(void)
102 {
103 unsigned int i, j;
104 unsigned int modifiers[] = { 0, LockMask, numlockmask, …
105 - KeyCode code;
106
107 XUngrabKey(dpy, AnyKey, AnyModifier, root);
108 for (i = 0; i < LENGTH(keys); i++)
109 - if ((code = XKeysymToKeycode(dpy, keys[i].keysy…
110 - for (j = 0; j < LENGTH(modifiers); j++)
111 - XGrabKey(dpy, code, keys[i].mod…
112 - True, GrabModeAsync, G…
113 + for (j = 0; j < LENGTH(modifiers); j++)
114 + XGrabKey(dpy, keys[i].keycode, keys[i].…
115 + True, GrabModeAsync, GrabModeA…
116 }
117 }
118
119 @@ -1001,13 +998,11 @@ void
120 keypress(XEvent *e)
121 {
122 unsigned int i;
123 - KeySym keysym;
124 XKeyEvent *ev;
125
126 ev = &e->xkey;
127 - keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
128 for (i = 0; i < LENGTH(keys); i++)
129 - if (keysym == keys[i].keysym
130 + if (ev->keycode == keys[i].keycode
131 && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
132 && keys[i].func)
133 keys[i].func(&(keys[i].arg));
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.