tabbed-keycode-20170508-6dc3978.diff (4571B)
1 diff --git a/config.def.h b/config.def.h 2 index 2d23049..b1384e4 100644 3 --- a/config.def.h 4 +++ b/config.def.h 5 @@ -36,31 +36,31 @@ static Bool npisrelative = False; 6 #define MODKEY ControlMask 7 static Key keys[] = { 8 /* modifier key function argument */ 9 - { MODKEY|ShiftMask, XK_Return, focusonce, { 0 } }, 10 - { MODKEY|ShiftMask, XK_Return, spawn, { 0 } }, 11 + { MODKEY|ShiftMask, 36, focusonce, { 0 } }, 12 + { MODKEY|ShiftMask, 36, spawn, { 0 } }, 13 14 - { MODKEY|ShiftMask, XK_l, rotate, { .i = +1 } }, 15 - { MODKEY|ShiftMask, XK_h, rotate, { .i = -1 } }, 16 - { MODKEY|ShiftMask, XK_j, movetab, { .i = -1 } }, 17 - { MODKEY|ShiftMask, XK_k, movetab, { .i = +1 } }, 18 - { MODKEY, XK_Tab, rotate, { .i = 0 } }, 19 + { MODKEY|ShiftMask, 46, rotate, { .i = +1 } }, 20 + { MODKEY|ShiftMask, 43, rotate, { .i = -1 } }, 21 + { MODKEY|ShiftMask, 44, movetab, { .i = -1 } }, 22 + { MODKEY|ShiftMask, 45, movetab, { .i = +1 } }, 23 + { MODKEY, 23, rotate, { .i = 0 } }, 24 25 - { MODKEY, XK_grave, spawn, SETPROP("_TABBED_SELECT_TAB") }, 26 - { MODKEY, XK_1, move, { .i = 0 } }, 27 - { MODKEY, XK_2, move, { .i = 1 } }, 28 - { MODKEY, XK_3, move, { .i = 2 } }, 29 - { MODKEY, XK_4, move, { .i = 3 } }, 30 - { MODKEY, XK_5, move, { .i = 4 } }, 31 - { MODKEY, XK_6, move, { .i = 5 } }, 32 - { MODKEY, XK_7, move, { .i = 6 } }, 33 - { MODKEY, XK_8, move, { .i = 7 } }, 34 - { MODKEY, XK_9, move, { .i = 8 } }, 35 - { MODKEY, XK_0, move, { .i = 9 } }, 36 + { MODKEY, 49, spawn, SETPROP("_TABBED_SELECT_TAB") }, 37 + { MODKEY, 10, move, { .i = 0 } }, 38 + { MODKEY, 11, move, { .i = 1 } }, 39 + { MODKEY, 12, move, { .i = 2 } }, 40 + { MODKEY, 13, move, { .i = 3 } }, 41 + { MODKEY, 14, move, { .i = 4 } }, 42 + { MODKEY, 15, move, { .i = 5 } }, 43 + { MODKEY, 16, move, { .i = 6 } }, 44 + { MODKEY, 17, move, { .i = 7 } }, 45 + { MODKEY, 18, move, { .i = 8 } }, 46 + { MODKEY, 19, move, { .i = 9 } }, 47 48 - { MODKEY, XK_q, killclient, { 0 } }, 49 + { MODKEY, 24, killclient, { 0 } }, 50 51 - { MODKEY, XK_u, focusurgent, { 0 } }, 52 - { MODKEY|ShiftMask, XK_u, toggle, { .v = (void*) &urgentswitch } }, 53 + { MODKEY, 30, focusurgent, { .v = NULL } }, 54 + { MODKEY|ShiftMask, 30, toggle, { .v = (void*) &urgentswitch } }, 55 56 - { 0, XK_F11, fullscreen, { 0 } }, 57 + { 0, 95, fullscreen, { 0 } }, 58 }; 59 diff --git a/tabbed.c b/tabbed.c 60 index ff3ada0..e30b4e2 100644 61 --- a/tabbed.c 62 +++ b/tabbed.c 63 @@ -58,7 +58,7 @@ typedef union { 64 65 typedef struct { 66 unsigned int mod; 67 - KeySym keysym; 68 + KeyCode keycode; 69 void (*func)(const Arg *); 70 const Arg arg; 71 } Key; 72 @@ -653,11 +653,9 @@ keypress(const XEvent *e) 73 { 74 const XKeyEvent *ev = &e->xkey; 75 unsigned int i; 76 - KeySym keysym; 77 78 - keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0); 79 for (i = 0; i < LENGTH(keys); i++) { 80 - if (keysym == keys[i].keysym && 81 + if (ev->keycode == keys[i].keycode && 82 CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && 83 keys[i].func) 84 keys[i].func(&(keys[i].arg)); 85 @@ -694,7 +692,6 @@ manage(Window w) 86 int i, j, nextpos; 87 unsigned int modifiers[] = { 0, LockMask, numlockmask, 88 numlockmask | LockMask }; 89 - KeyCode code; 90 Client *c; 91 XEvent e; 92 93 @@ -705,12 +702,10 @@ manage(Window w) 94 XSync(dpy, False); 95 96 for (i = 0; i < LENGTH(keys); i++) { 97 - if ((code = XKeysymToKeycode(dpy, keys[i].keysym))) { 98 - for (j = 0; j < LENGTH(modifiers); j++) { 99 - XGrabKey(dpy, code, keys[i].mod | 100 - modifiers[j], w, True, 101 - GrabModeAsync, GrabModeAsync); 102 - } 103 + for (j = 0; j < LENGTH(modifiers); ++j) { 104 + XGrabKey(dpy, keys[i].keycode, 105 + keys[i].mod | modifiers[j], w, 106 + True, GrabModeAsync, GrabModeAsync); 107 } 108 } 109