commit c6e67d696e98f12e1d0d74a79023a32c1d965826
parent 2e847cfa81393a9799b671be6033fb305f6f057b
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Sat, 15 Aug 2020 21:04:22 -0500
Added grid
Diffstat:
3 files changed, 112 insertions(+), 2 deletions(-)
diff --git a/README b/README
@@ -42,12 +42,14 @@ patches!
(1). https://tools.suckless.org/dmenu/patches/
- CURRENT PROGRESS: 4/32 patches supported
- 1/32 patches unsupported
+ CURRENT PROGRESS: 5/32 patches supported
+ 2/32 patches unsupported
USUPPORTED PATCHES:
(1). fuzzyhighlight - https://tools.suckless.org/dmenu/patches/fuzzyhighlight/
|-Targets 4.9, Gentoo stable x11-misc/dmenu is version 4.8 currently
+ (2). fuzzymatch - https://tools.suckless.org/dmenu/patches/fuzzymatch/dmenu-fuzzymatch-20170603-f428f3e.diff
+ |-Makes changes to config.def.mk that I have yet to successfully integrate with the default ebuild
NOTE THAT UNSUPPORTED PATCHES SHOULD BE SUPPORTED IN THE FUTURE!!!
diff --git a/patches/grid/USAGE b/patches/grid/USAGE
@@ -0,0 +1,31 @@
+grid - Adds -g option to dwm for columnar layout
+Source: https://tools.suckless.org/dmenu/patches/grid/dmenu-grid-4.9.diff
+Original Author: Miles Alan m@milesalan.com
+
+Description from source:
+ """
+ This patch allows you to render dmenu's entries in a grid by adding a new -g flag
+ to specify the number of grid columns. You can use -g and -l together to create a
+ G columns * L lines grid.
+
+ This can help save screenspace over the default, 1 column, behavior of -l.
+ """
+
+== YOU MUST ==
+(1). Place the patch file in /etc/portage/patches/x11-misc/dmenu/
+(2). Add the following line to your savedconfig file:
+
+ static unsigned int columns = 0;
+
+ Set 'columns' to be equal the number of columns you want dmenu to start with by default.
+(3). Run 'emerge dmenu'
+
+== YOU PROBABLY SHOULD ==
+(1). Run dmenu with the '-l' option to specify the number of columns. '-l' can be run together
+ with '-g' to create a grid.
+
+== PATCH MODIFICATIONS ==
+(1). Removed lines relating to config.def.h
+
+== INCOMPATIBILITIES ==
+No known specific incompatibilities.
diff --git a/patches/grid/grid.patch b/patches/grid/grid.patch
@@ -0,0 +1,77 @@
+diff --git a/dmenu.1 b/dmenu.1
+index 323f93c..d0a734a 100644
+--- a/dmenu.1
++++ b/dmenu.1
+@@ -4,6 +4,8 @@ dmenu \- dynamic menu
+ .SH SYNOPSIS
+ .B dmenu
+ .RB [ \-bfiv ]
++.RB [ \-g
++.IR columns ]
+ .RB [ \-l
+ .IR lines ]
+ .RB [ \-m
+@@ -47,8 +49,11 @@ is faster, but will lock up X until stdin reaches end\-of\-file.
+ .B \-i
+ dmenu matches menu items case insensitively.
+ .TP
++.BI \-g " columns"
++dmenu lists items in a grid with the given number of columns.
++.TP
+ .BI \-l " lines"
+-dmenu lists items vertically, with the given number of lines.
++dmenu lists items in a grid with the given number of lines.
+ .TP
+ .BI \-m " monitor"
+ dmenu is displayed on the monitor number supplied. Monitor numbers are starting
+diff --git a/dmenu.c b/dmenu.c
+index 6b8f51b..d79b6bb 100644
+--- a/dmenu.c
++++ b/dmenu.c
+@@ -77,7 +77,7 @@ calcoffsets(void)
+ int i, n;
+
+ if (lines > 0)
+- n = lines * bh;
++ n = lines * columns * bh;
+ else
+ n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
+ /* calculate which items will begin the next page and previous page */
+@@ -152,9 +152,15 @@ drawmenu(void)
+ }
+
+ if (lines > 0) {
+- /* draw vertical list */
+- for (item = curr; item != next; item = item->right)
+- drawitem(item, x, y += bh, mw - x);
++ /* draw grid */
++ int i = 0;
++ for (item = curr; item != next; item = item->right, i++)
++ drawitem(
++ item,
++ x + ((i / lines) * ((mw - x) / columns)),
++ y + (((i % lines) + 1) * bh),
++ (mw - x) / columns
++ );
+ } else if (matches) {
+ /* draw horizontal list */
+ x += inputw;
+@@ -708,9 +714,13 @@ main(int argc, char *argv[])
+ } else if (i + 1 == argc)
+ usage();
+ /* these options take one argument */
+- else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
++ else if (!strcmp(argv[i], "-g")) { /* number of columns in grid */
++ columns = atoi(argv[++i]);
++ if (lines == 0) lines = 1;
++ } else if (!strcmp(argv[i], "-l")) { /* number of lines in grid */
+ lines = atoi(argv[++i]);
+- else if (!strcmp(argv[i], "-m"))
++ if (columns == 0) columns = 1;
++ } else if (!strcmp(argv[i], "-m"))
+ mon = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
+ prompt = argv[++i];
+--
+2.23.1
+