[wiki] [sites] [dmenu][patch][gridnav] new patch for moving left and right in a grid || Nathan Sketch

From: <git_AT_suckless.org>
Date: Mon, 23 Nov 2020 03:22:58 +0100

commit bcbd3451f903770c5ae527416356ec922ba1aca0
Author: Nathan Sketch <sketchn98_AT_gmail.com>
Date: Sun Nov 22 21:08:45 2020 -0500

    [dmenu][patch][gridnav] new patch for moving left and right in a grid

diff --git a/tools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff b/tools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff
new file mode 100644
index 00000000..9a555272
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff
_AT_@ -0,0 +1,72 @@
+diff --git a/dmenu.c b/dmenu.c
+index 7361377..76acee6 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -7,6 +7,7 @@
+ #include <strings.h>
+ #include <time.h>
+ #include <unistd.h>
++#include <stdbool.h>
+
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
+_AT_@ -317,6 +318,9 @@ keypress(XKeyEvent *ev)
+ int len;
+ KeySym ksym;
+ Status status;
++ int i;
++ struct item *tmpsel;
++ bool offscreen = false;
+
+ len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
+ switch (status) {
+_AT_@ -443,6 +447,24 @@ insert:
+ calcoffsets();
+ break;
+ case XK_Left:
++ if (columns > 1) {
++ if (!sel)
++ return;
++ tmpsel = sel;
++ for (i = 0; i < lines; i++) {
++ if (!tmpsel->left || tmpsel->left->right != tmpsel)
++ return;
++ if (tmpsel == curr)
++ offscreen = true;
++ tmpsel = tmpsel->left;
++ }
++ sel = tmpsel;
++ if (offscreen) {
++ curr = prev;
++ calcoffsets();
++ }
++ break;
++ }
+ if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
+ cursor = nextrune(-1);
+ break;
+_AT_@ -479,6 +501,24 @@ insert:
+ sel->out = 1;
+ break;
+ case XK_Right:
++ if (columns > 1) {
++ if (!sel)
++ return;
++ tmpsel = sel;
++ for (i = 0; i < lines; i++) {
++ if (!tmpsel->right || tmpsel->right->left != tmpsel)
++ return;
++ tmpsel = tmpsel->right;
++ if (tmpsel == next)
++ offscreen = true;
++ }
++ sel = tmpsel;
++ if (offscreen) {
++ curr = next;
++ calcoffsets();
++ }
++ break;
++ }
+ if (text[cursor] != '+ cursor = nextrune(+1);
+ break;
diff --git a/tools.suckless.org/dmenu/patches/gridnav/index.md b/tools.suckless.org/dmenu/patches/gridnav/index.md
new file mode 100644
index 00000000..23d29773
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/gridnav/index.md
_AT_@ -0,0 +1,12 @@
+gridnav
+=======
+This patch adds the ability to move left and right through a [grid](../grid).
+Apply this patch after grid.
+
+Download
+--------
+* [dmenu-gridnav-5.0.diff](dmenu-gridnav-5.0.diff)
+
+Author
+------
+* Nathan Sketch <sketchn98_AT_gmail.com>
Received on Mon Nov 23 2020 - 03:22:58 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 23 2020 - 03:24:43 CET