diff options
author | Acid Bong <acid-bong@cock.lt> | 2022-12-28 18:49:06 +0200 |
---|---|---|
committer | Acid Bong <acid-bong@cock.lt> | 2022-12-29 21:44:24 +0200 |
commit | 896b6c49aad3e351f528fcbf9c141473ff5cf264 (patch) | |
tree | 06bb7f06ef3ea592a9b476700710062eccf01762 | |
parent | a3ef99f743e79604e0e0b2f7bab38e3cea4dc091 (diff) | |
parent | 89f9905714c1c1b2e8b09986dfbeca15b68d8af8 (diff) | |
download | dwm-896b6c49aad3e351f528fcbf9c141473ff5cf264.tar.gz |
Merge branch 'master' into bong
-rw-r--r-- | dwm.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/dwm.c b/dwm.c index bd29dc7..5aaf9df 100644 --- a/dwm.c +++ b/dwm.c @@ -1236,16 +1236,26 @@ grabkeys(void) { updatenumlockmask(); { - unsigned int i, j; + unsigned int i, j, k; unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask }; - KeyCode code; + int start, end, skip; + KeySym *syms; XUngrabKey(dpy, AnyKey, AnyModifier, root); - for (i = 0; i < LENGTH(keys); i++) - if ((code = XKeysymToKeycode(dpy, keys[i].keysym))) - for (j = 0; j < LENGTH(modifiers); j++) - XGrabKey(dpy, code, keys[i].mod | modifiers[j], root, - True, GrabModeAsync, GrabModeAsync); + XDisplayKeycodes(dpy, &start, &end); + syms = XGetKeyboardMapping(dpy, start, end - start + 1, &skip); + if (!syms) + return; + for (k = start; k <= end; k++) + for (i = 0; i < LENGTH(keys); i++) + /* skip modifier codes, we do that ourselves */ + if (keys[i].keysym == syms[(k - start) * skip]) + for (j = 0; j < LENGTH(modifiers); j++) + XGrabKey(dpy, k, + keys[i].mod | modifiers[j], + root, True, + GrabModeAsync, GrabModeAsync); + XFree(syms); } } @@ -2076,6 +2086,8 @@ sigterm(int unused) void spawn(const Arg *arg) { + if (arg->v == dmenucmd) + dmenumon[0] = '0' + selmon->num; if (fork() == 0) { if (dpy) close(ConnectionNumber(dpy)); |