[wiki] [sites] [dmenu][patch][tsv-alt] Add patch for dmenu 5.3 || Max Schillinger
commit 8f07a40311451be6413b289a8a3fb50098cc29b7
Author: Max Schillinger <maxschillinger_AT_web.de>
Date: Sat Jul 13 21:18:45 2024 +0200
[dmenu][patch][tsv-alt] Add patch for dmenu 5.3
diff --git a/tools.suckless.org/dmenu/patches/tsv-alt/dmenu-tsv-alt-5.3.diff b/tools.suckless.org/dmenu/patches/tsv-alt/dmenu-tsv-alt-5.3.diff
new file mode 100644
index 00000000..378d6989
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/tsv-alt/dmenu-tsv-alt-5.3.diff
_AT_@ -0,0 +1,135 @@
+From 89ff978d15ff6b58e21bf871f09ceab2bf813138 Mon Sep 17 00:00:00 2001
+From: Max Schillinger <maxschillinger_AT_web.de>
+Date: Sat, 13 Jul 2024 21:06:57 +0200
+Subject: [PATCH] tsv-alt patch for dmenu 5.3
+
+---
+ config.def.h | 5 +++++
+ dmenu.1 | 6 +++++-
+ dmenu.c | 26 ++++++++++++++++++--------
+ 3 files changed, 28 insertions(+), 9 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1edb647..bd0fcef 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -21,3 +21,8 @@ static unsigned int lines = 0;
+ * for example: " /?\"&[]"
+ */
+ static const char worddelimiters[] = " ";
++
++/* tsv-alt: reverse the order of tab separation.
++ * 0 = display<TAB>output. 1 = output<TAB>display
++ * can be reversed with -r as well */
++static int revtab = 0;
+diff --git a/dmenu.1 b/dmenu.1
+index 323f93c..e767276 100644
+--- a/dmenu.1
++++ b/dmenu.1
+_AT_@ -3,7 +3,7 @@
+ dmenu \- dynamic menu
+ .SH SYNOPSIS
+ .B dmenu
+-.RB [ \-bfiv ]
++.RB [ \-bfirv ]
+ .RB [ \-l
+ .IR lines ]
+ .RB [ \-m
+_AT_@ -80,6 +80,10 @@ prints version information to stdout, then exits.
+ .TP
+ .BI \-w " windowid"
+ embed into windowid.
++.TP
++.B \-r
++tsv-alt: reverse the behavior of tab separation.
++.TP
+ .SH USAGE
+ dmenu is completely controlled by the keyboard. Items are selected using the
+ arrow keys, page up, page down, home, and end.
+diff --git a/dmenu.c b/dmenu.c
+index 40f93e0..04bb085 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -29,6 +29,7 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
+
+ struct item {
+ char *text;
++ char *otext;
+ struct item *left, *right;
+ int out;
+ };
+_AT_@ -104,7 +105,7 @@ cleanup(void)
+ for (i = 0; i < SchemeLast; i++)
+ free(scheme[i]);
+ for (i = 0; items && items[i].text; ++i)
+- free(items[i].text);
++ free(revtab ? items[i].otext : items[i].text);
+ free(items);
+ drw_free(drw);
+ XSync(dpy, False);
+_AT_@ -489,7 +490,7 @@ insert:
+ break;
+ case XK_Return:
+ case XK_KP_Enter:
+- puts((sel && !(ev->state & ShiftMask)) ? sel->text : text);
++ puts((sel && !(ev->state & ShiftMask)) ? sel->otext : text);
+ if (!(ev->state & ControlMask)) {
+ cleanup();
+ exit(0);
+_AT_@ -548,7 +549,7 @@ paste(void)
+ static void
+ readstdin(void)
+ {
+- char *line = NULL;
++ char *line = NULL, *tmp;
+ size_t i, itemsiz = 0, linesiz = 0;
+ ssize_t len;
+
+_AT_@ -561,14 +562,21 @@ readstdin(void)
+ }
+ if (line[len - 1] == '
')
+ line[len - 1] = '+- if (!(items[i].text = strdup(line)))
++ if (!(items[i].text = items[i].otext = strdup(line)))
+ die("strdup:");
+-
++ if ((items[i].otext = strchr(items[i].otext, ' '))) {
++ *items[i].otext++ = '++ if (revtab) {
++ tmp = items[i].text;
++ items[i].text = items[i].otext;
++ items[i].otext = tmp;
++ }
++ }
+ items[i].out = 0;
+ }
+ free(line);
+ if (items)
+- items[i].text = NULL;
++ items[i].text = items[i].otext = NULL;
+ lines = MIN(lines, i);
+ }
+
+_AT_@ -715,7 +723,7 @@ setup(void)
+ static void
+ usage(void)
+ {
+- die("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
++ die("usage: dmenu [-bfirv] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]");
+ }
+
+_AT_@ -737,7 +745,9 @@ main(int argc, char *argv[])
+ else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
+ fstrncmp = strncasecmp;
+ fstrstr = cistrstr;
+- } else if (i + 1 == argc)
++ } else if (!strcmp(argv[i], "-r")) /* reverse the tab separation */
++ revtab = (!revtab);
++ else if (i + 1 == argc)
+ usage();
+ /* these options take one argument */
+ else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
+--
+2.45.2
+
diff --git a/tools.suckless.org/dmenu/patches/tsv-alt/index.md b/tools.suckless.org/dmenu/patches/tsv-alt/index.md
index 54fead60..9f38a6c2 100644
--- a/tools.suckless.org/dmenu/patches/tsv-alt/index.md
+++ b/tools.suckless.org/dmenu/patches/tsv-alt/index.md
_AT_@ -24,7 +24,9 @@ due to said commit changing how stdin is read.
Download
--------
* [dmenu-tsv-alt-20220919-fce06f4.diff](dmenu-tsv-alt-20220919-fce06f4.diff)
+* [dmenu-tsv-alt-5.3.diff](dmenu-tsv-alt-5.3.diff)
-Author
-------
+Authors
+-------
* yosh
+* Max Schillinger - <maxschillinger_AT_web.de> (5.3 version)
Received on Sat Jul 13 2024 - 21:18:47 CEST
This archive was generated by hypermail 2.3.0
: Sat Jul 13 2024 - 21:24:52 CEST