dmenu

my build of dynamic menu
git clone git://git.kocotian.pl/dmenu.git
Log | Files | Refs | README | LICENSE

commit d0b408c4763ae098ec72b3e40ab4ecdf1042e55e
parent f829f538ade27f441389a22eb51734d655e42636
Author: kocotian <kocotian@kocotian.pl>
Date:   Wed, 30 Dec 2020 11:52:18 +0100

gridnav

Diffstat:
Mdmenu.c | 40++++++++++++++++++++++++++++++++++++++++
Mpatches/dmenu-gridnav-5.0.diff | 0
2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/dmenu.c b/dmenu.c @@ -8,6 +8,7 @@ #include <strings.h> #include <time.h> #include <unistd.h> +#include <stdbool.h> #include <X11/Xlib.h> #include <X11/Xatom.h> @@ -412,6 +413,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) { @@ -538,6 +542,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; @@ -574,6 +596,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] != '\0') { cursor = nextrune(+1); break; diff --git a/patches/dmenu-gridnav-5.0.diff b/patches/dmenu-gridnav-5.0.diff