[wiki] [sites] [tabbed][patch][ungrabkey] Add new patch || Chris Noxz

From: <git_AT_suckless.org>
Date: Tue, 11 Jun 2024 20:26:19 +0200

commit fa2a28b10a4353ee7cbab547bb468383d73d3b45
Author: Chris Noxz <chris_AT_noxz.tech>
Date: Tue Jun 11 20:22:43 2024 +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.

diff --git a/tools.suckless.org/tabbed/patches/ungrabkey/index.md b/tools.suckless.org/tabbed/patches/ungrabkey/index.md
new file mode 100644
index 00000000..14774234
--- /dev/null
+++ b/tools.suckless.org/tabbed/patches/ungrabkey/index.md
_AT_@ -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_AT_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
new file mode 100644
index 00000000..14a1d708
--- /dev/null
+++ b/tools.suckless.org/tabbed/patches/ungrabkey/tabbed-ungrabkey-0.8.diff
_AT_@ -0,0 +1,33 @@
+Author: Chris Noxz <chris_AT_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
+_AT_@ -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);
+_AT_@ -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--;
Received on Tue Jun 11 2024 - 20:26:19 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 11 2024 - 20:36:52 CEST