commit f9cf6541ad9b8951f5aa22b311114f12807ffcad
Author: vishal <[email protected]>
Date:   Sat Jan 6 12:16:46 2024 +0530

    This commit is to add the patch dmenu/patches/no-default-select/.
    I have written everything regarding it in the patch's index.md file.

diff --git 
a/tools.suckless.org/dmenu/patches/no-default-select/dmenu-nodefaultsel-20240105-9a6ef61.diff
 
b/tools.suckless.org/dmenu/patches/no-default-select/dmenu-nodefaultsel-20240105-9a6ef61.diff
new file mode 100644
index 00000000..bba2b302
--- /dev/null
+++ 
b/tools.suckless.org/dmenu/patches/no-default-select/dmenu-nodefaultsel-20240105-9a6ef61.diff
@@ -0,0 +1,69 @@
+From 9a6ef6174ade2913e940d453f81c488b47d365fa Mon Sep 17 00:00:00 2001
+From: vishal <[email protected]>
+Date: Fri, 5 Jan 2024 16:54:19 +0530
+Subject: [PATCH] With this patch dmenu will no longer select the first item by
+ default and you can use right and left key for bothmoving in text and drop
+ down. dependencies: grid and gridnav
+
+---
+ dmenu.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/dmenu.c b/dmenu.c
+index 1a76e1b..050073b 100644
+--- a/dmenu.c
++++ b/dmenu.c
+@@ -282,7 +282,7 @@ match(void)
+                       matches = lsubstr;
+               matchend = substrend;
+       }
+-      curr = sel = matches;
++      curr = matches;
+       calcoffsets();
+ }
+ 
+@@ -467,8 +467,10 @@ insert:
+               break;
+       case XK_Left:
+               if (columns > 1) {
+-                      if (!sel)
++                      if (!sel){
++                              system("xdotool key KP_Left");
+                               return;
++                      }
+                       tmpsel = sel;
+                       for (i = 0; i < lines; i++) {
+                               if (!tmpsel->left || tmpsel->left->right != 
tmpsel) {
+@@ -501,6 +503,8 @@ insert:
+                       curr = prev;
+                       calcoffsets();
+               }
++              else if (sel && !sel->left)
++                      sel = NULL;
+               break;
+       case XK_Next:
+       case XK_KP_Next:
+@@ -528,8 +532,10 @@ insert:
+               break;
+       case XK_Right:
+               if (columns > 1) {
+-                      if (!sel)
++                      if (!sel) {
++                              system("xdotool key KP_Right");
+                               return;
++                      }
+                       tmpsel = sel;
+                       for (i = 0; i < lines; i++) {
+                               if (!tmpsel->right ||  tmpsel->right->left != 
tmpsel) {
+@@ -562,6 +568,8 @@ insert:
+                       curr = next;
+                       calcoffsets();
+               }
++              else if (!sel && curr)
++                      sel = curr;
+               break;
+       case XK_Tab:
+               if (!sel)
+-- 
+2.43.0
+
diff --git a/tools.suckless.org/dmenu/patches/no-default-select/index.md 
b/tools.suckless.org/dmenu/patches/no-default-select/index.md
new file mode 100644
index 00000000..5b2dfddd
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/no-default-select/index.md
@@ -0,0 +1,16 @@
+no-default-select
+=================
+This patch changes how the default selection works. It depends on 
[gridnav](../gridnav).
+
+By default, dmenu selects the first entry.
+I like the [gridnav](../gridnav) patch which along with [grid](../grid) lets 
you see the results in a grid and use right and left arrow to move around in 
dropdown. But you lose the ability to move in typed text because the default 
selection feature of dmenu.
+
+This patch fixes it by not selecting anything by default. So, now one can move 
in text and in dropdown.
+
+Download
+--------
+* [dmenu-nodefaultsel-5.2.diff](dmenu-nodefaultsel-20240105-9a6ef61.diff)
+
+Author
+------
+* Vishal Tripathy <[email protected]>


Reply via email to