commit fa2a28b10a4353ee7cbab547bb468383d73d3b45
parent 7575ad5de71d2c945524af940c206001c2807747
Author: Chris Noxz <chris@noxz.tech>
Date: Tue, 11 Jun 2024 20:22:43 +0200
[tabbed][patch][ungrabkey] Add new patch
Fix key binding issues when moving or unmanaging clients in tabbed
When moving clients between tabbed sessions, or simply unmanaging a client,
the old tabbed session can retain control, affecting key bindings in the new
session. This patch resolves the issue by ungrabbing the keys when a client is
being unmanaged.
Diffstat:
2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/tools.suckless.org/tabbed/patches/ungrabkey/index.md b/tools.suckless.org/tabbed/patches/ungrabkey/index.md
@@ -0,0 +1,19 @@
+ungrabkey
+=========
+
+Description
+-----------
+I like to move clients between different tabbed sessions. When moving clients
+between tabbed windows, problems can arise. Sometimes, the previous tabbed
+session retains control, affecting key bindings in the new session. This issue
+also persists if a client is simply unmanaged, as key bindings remain active
+outside of the tabbed session. This problem can be resolved by ungrabbing the
+keys when a client is being unmanaged.
+
+Download
+--------
+* [tabbed-ungrabkey-0.8.diff](tabbed-ungrabkey-0.8.diff)
+
+Authors
+-------
+* Chris Noxz - <chris@noxz.tech>
diff --git a/tools.suckless.org/tabbed/patches/ungrabkey/tabbed-ungrabkey-0.8.diff b/tools.suckless.org/tabbed/patches/ungrabkey/tabbed-ungrabkey-0.8.diff
@@ -0,0 +1,33 @@
+Author: Chris Noxz <chris@noxz.tech>
+
+diff -upN tabbed-0.8-a/tabbed.c tabbed-0.8-b/tabbed.c
+--- tabbed-0.8-a/tabbed.c 2024-03-19 12:23:17.000000000 +0100
++++ tabbed-0.8-b/tabbed.c 2024-06-11 20:07:21.814961956 +0200
+@@ -1132,6 +1132,11 @@ toggle(const Arg *arg)
+ void
+ unmanage(int c)
+ {
++ int i, j;
++ unsigned int modifiers[] = { 0, LockMask, numlockmask,
++ numlockmask | LockMask };
++ KeyCode code;
++
+ if (c < 0 || c >= nclients) {
+ drawbar();
+ XSync(dpy, False);
+@@ -1141,6 +1146,15 @@ unmanage(int c)
+ if (!nclients)
+ return;
+
++ /* ungrab keys */
++ for (i = 0; i < LENGTH(keys); i++) {
++ if ((code = XKeysymToKeycode(dpy, keys[i].keysym))) {
++ for (j = 0; j < LENGTH(modifiers); j++) {
++ XUngrabKey(dpy, code, keys[i].mod | modifiers[j], clients[c]->win);
++ }
++ }
++ }
++
+ if (c == 0) {
+ /* First client. */
+ nclients--;