summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PKGBUILD4
-rw-r--r--README24
-rw-r--r--README.md8
-rw-r--r--config.def.h3
-rw-r--r--config.h3
-rw-r--r--dmenu.15
-rw-r--r--dmenu.c20
-rw-r--r--patches/dmenu-lineheight-5.0.diff106
-rw-r--r--patches/dmenu-tsv-20201101-1a13d04.diff53
9 files changed, 195 insertions, 31 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 1b99ea4..41f6d50 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -29,10 +29,10 @@ source=(
)
md5sums=(
'SKIP'
- '6d789bd834af710ebe007e1f6fed75f0'
+ 'c57c5e294af126671488056da90c9c23'
'952dc86e34617de02ddde41a2f256de0'
'db0fc5f7f2a21e5cec73349ebdaa954a'
- 'd7fb7dee6a9a51865ceea1e985c4c98b'
+ '61e4c159ccea7ce7164cd2a0d2a55bc7'
'02767b3eda4ab44b52e190ec3e01fec6'
'95ce4577f2a6640db4ee22520f83a69b'
'9f65b5d073c1aa9c28ef69be0a88b0dc'
diff --git a/README b/README
deleted file mode 100644
index a8fcdfe..0000000
--- a/README
+++ /dev/null
@@ -1,24 +0,0 @@
-dmenu - dynamic menu
-====================
-dmenu is an efficient dynamic menu for X.
-
-
-Requirements
-------------
-In order to build dmenu you need the Xlib header files.
-
-
-Installation
-------------
-Edit config.mk to match your local setup (dmenu is installed into
-the /usr/local namespace by default).
-
-Afterwards enter the following command to build and install dmenu
-(if necessary as root):
-
- make clean install
-
-
-Running dmenu
--------------
-See the man page for details.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7f2fc20
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# Dynamic Menu
+
+Forked from [dmenu-v5.0](https://tools.suckless.org/dmenu/)
+
+Installed patches:
+* [tsv](https://tools.suckless.org/dmenu/patches/tsv/)
+* [lineheight](https://tools.suckless.org/dmenu/patches/line-height/)
+
diff --git a/config.def.h b/config.def.h
index 1edb647..4394dec 100644
--- a/config.def.h
+++ b/config.def.h
@@ -15,6 +15,9 @@ static const char *colors[SchemeLast][2] = {
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines = 0;
+/* -h option; minimum height of a menu line */
+static unsigned int lineheight = 0;
+static unsigned int min_lineheight = 8;
/*
* Characters not considered part of a word while deleting words
diff --git a/config.h b/config.h
index 1edb647..4394dec 100644
--- a/config.h
+++ b/config.h
@@ -15,6 +15,9 @@ static const char *colors[SchemeLast][2] = {
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines = 0;
+/* -h option; minimum height of a menu line */
+static unsigned int lineheight = 0;
+static unsigned int min_lineheight = 8;
/*
* Characters not considered part of a word while deleting words
diff --git a/dmenu.1 b/dmenu.1
index 323f93c..f2a82b4 100644
--- a/dmenu.1
+++ b/dmenu.1
@@ -6,6 +6,8 @@ dmenu \- dynamic menu
.RB [ \-bfiv ]
.RB [ \-l
.IR lines ]
+.RB [ \-h
+.IR height ]
.RB [ \-m
.IR monitor ]
.RB [ \-p
@@ -50,6 +52,9 @@ dmenu matches menu items case insensitively.
.BI \-l " lines"
dmenu lists items vertically, with the given number of lines.
.TP
+.BI \-h " height"
+dmenu uses a menu line of at least 'height' pixels tall, but no less than 8.
+.TP
.BI \-m " monitor"
dmenu is displayed on the monitor number supplied. Monitor numbers are starting
from 0.
diff --git a/dmenu.c b/dmenu.c
index 65f25ce..cbeecf6 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -30,6 +30,7 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
struct item {
char *text;
+ char *stext;
struct item *left, *right;
int out;
};
@@ -123,7 +124,7 @@ drawitem(struct item *item, int x, int y, int w)
else
drw_setscheme(drw, scheme[SchemeNorm]);
- return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0);
+ return drw_text(drw, x, y, w, bh, lrpad / 2, item->stext, 0);
}
static void
@@ -131,7 +132,7 @@ drawmenu(void)
{
unsigned int curpos;
struct item *item;
- int x = 0, y = 0, w;
+ int x = 0, y = 0, fh = drw->fonts->h, w;
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, 0, 0, mw, mh, 1, 1);
@@ -148,7 +149,7 @@ drawmenu(void)
curpos = TEXTW(text) - TEXTW(&text[cursor]);
if ((curpos += lrpad / 2 - 1) < w) {
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
+ drw_rect(drw, x + curpos, 2 + (bh - fh) / 2, 2, fh - 4, 1, 0);
}
if (lines > 0) {
@@ -165,7 +166,7 @@ drawmenu(void)
}
x += w;
for (item = curr; item != next; item = item->right)
- x = drawitem(item, x, 0, MIN(TEXTW(item->text), mw - x - TEXTW(">")));
+ x = drawitem(item, x, 0, MIN(TEXTW(item->stext), mw - x - TEXTW(">")));
if (next) {
w = TEXTW(">");
drw_setscheme(drw, scheme[SchemeNorm]);
@@ -534,6 +535,10 @@ readstdin(void)
*p = '\0';
if (!(items[i].text = strdup(buf)))
die("cannot strdup %u bytes:", strlen(buf) + 1);
+ if ((p = strchr(buf, '\t')))
+ *p = '\0';
+ if (!(items[i].stext = strdup(buf)))
+ die("cannot strdup %u bytes:", strlen(buf) + 1);
items[i].out = 0;
drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL);
if (tmpmax > inputw) {
@@ -609,6 +614,7 @@ setup(void)
/* calculate menu geometry */
bh = drw->fonts->h + 2;
+ bh = MAX(bh,lineheight); /* make a menu line AT LEAST 'lineheight' tall */
lines = MAX(lines, 0);
mh = (lines + 1) * bh;
#ifdef XINERAMA
@@ -689,7 +695,7 @@ setup(void)
static void
usage(void)
{
- fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
+ fputs("usage: dmenu [-bfiv] [-l lines] [-h height] [-p prompt] [-fn font] [-m monitor]\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
exit(1);
}
@@ -717,6 +723,10 @@ main(int argc, char *argv[])
/* these options take one argument */
else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
lines = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-h")) { /* minimum height of one menu line */
+ lineheight = atoi(argv[++i]);
+ lineheight = MAX(lineheight, min_lineheight);
+ }
else if (!strcmp(argv[i], "-m"))
mon = atoi(argv[++i]);
else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
diff --git a/patches/dmenu-lineheight-5.0.diff b/patches/dmenu-lineheight-5.0.diff
new file mode 100644
index 0000000..3b0df3d
--- /dev/null
+++ b/patches/dmenu-lineheight-5.0.diff
@@ -0,0 +1,106 @@
+From ba103e38ea4ab07f9a3ee90627714b9bea17c329 Mon Sep 17 00:00:00 2001
+From: pskry <peter@skrypalle.dk>
+Date: Sun, 8 Nov 2020 22:04:22 +0100
+Subject: [PATCH] Add an option which defines the lineheight
+
+Despite both the panel and dmenu using the same font (a Terminus 12),
+dmenu is shorter and the panel is visible from under the dmenu bar.
+The appearance can be even more distracting when using similar colors
+for background and selections. With the option added by this patch,
+dmenu can be launched with a '-h 24', thus completely covering the panel.
+---
+ config.def.h | 3 +++
+ dmenu.1 | 5 +++++
+ dmenu.c | 11 ++++++++---
+ 3 files changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1edb647..4394dec 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -15,6 +15,9 @@ static const char *colors[SchemeLast][2] = {
+ };
+ /* -l option; if nonzero, dmenu uses vertical list with given number of lines */
+ static unsigned int lines = 0;
++/* -h option; minimum height of a menu line */
++static unsigned int lineheight = 0;
++static unsigned int min_lineheight = 8;
+
+ /*
+ * Characters not considered part of a word while deleting words
+diff --git a/dmenu.1 b/dmenu.1
+index 323f93c..f2a82b4 100644
+--- a/dmenu.1
++++ b/dmenu.1
+@@ -6,6 +6,8 @@ dmenu \- dynamic menu
+ .RB [ \-bfiv ]
+ .RB [ \-l
+ .IR lines ]
++.RB [ \-h
++.IR height ]
+ .RB [ \-m
+ .IR monitor ]
+ .RB [ \-p
+@@ -50,6 +52,9 @@ dmenu matches menu items case insensitively.
+ .BI \-l " lines"
+ dmenu lists items vertically, with the given number of lines.
+ .TP
++.BI \-h " height"
++dmenu uses a menu line of at least 'height' pixels tall, but no less than 8.
++.TP
+ .BI \-m " monitor"
+ dmenu is displayed on the monitor number supplied. Monitor numbers are starting
+ from 0.
+diff --git a/dmenu.c b/dmenu.c
+index 65f25ce..f2a4047 100644
+--- a/dmenu.c
++++ b/dmenu.c
+@@ -131,7 +131,7 @@ drawmenu(void)
+ {
+ unsigned int curpos;
+ struct item *item;
+- int x = 0, y = 0, w;
++ int x = 0, y = 0, fh = drw->fonts->h, w;
+
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, 0, 0, mw, mh, 1, 1);
+@@ -148,7 +148,7 @@ drawmenu(void)
+ curpos = TEXTW(text) - TEXTW(&text[cursor]);
+ if ((curpos += lrpad / 2 - 1) < w) {
+ drw_setscheme(drw, scheme[SchemeNorm]);
+- drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
++ drw_rect(drw, x + curpos, 2 + (bh - fh) / 2, 2, fh - 4, 1, 0);
+ }
+
+ if (lines > 0) {
+@@ -609,6 +609,7 @@ setup(void)
+
+ /* calculate menu geometry */
+ bh = drw->fonts->h + 2;
++ bh = MAX(bh,lineheight); /* make a menu line AT LEAST 'lineheight' tall */
+ lines = MAX(lines, 0);
+ mh = (lines + 1) * bh;
+ #ifdef XINERAMA
+@@ -689,7 +690,7 @@ setup(void)
+ static void
+ usage(void)
+ {
+- fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
++ fputs("usage: dmenu [-bfiv] [-l lines] [-h height] [-p prompt] [-fn font] [-m monitor]\n"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
+ exit(1);
+ }
+@@ -717,6 +718,10 @@ main(int argc, char *argv[])
+ /* these options take one argument */
+ else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
+ lines = atoi(argv[++i]);
++ else if (!strcmp(argv[i], "-h")) { /* minimum height of one menu line */
++ lineheight = atoi(argv[++i]);
++ lineheight = MAX(lineheight, min_lineheight);
++ }
+ else if (!strcmp(argv[i], "-m"))
+ mon = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
+--
+2.29.2
+
diff --git a/patches/dmenu-tsv-20201101-1a13d04.diff b/patches/dmenu-tsv-20201101-1a13d04.diff
new file mode 100644
index 0000000..4782861
--- /dev/null
+++ b/patches/dmenu-tsv-20201101-1a13d04.diff
@@ -0,0 +1,53 @@
+From 4d58bc01c9a31cdcaad540e67e5f60c87f488b55 Mon Sep 17 00:00:00 2001
+From: prenev <an2qzavok@gmail.com>
+Date: Sun, 1 Nov 2020 15:50:10 +0300
+Subject: [PATCH] tab-separate input lines and only display first parts
+
+---
+ dmenu.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/dmenu.c b/dmenu.c
+index 65f25ce..d9e490a 100644
+--- a/dmenu.c
++++ b/dmenu.c
+@@ -30,6 +30,7 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
+
+ struct item {
+ char *text;
++ char *stext;
+ struct item *left, *right;
+ int out;
+ };
+@@ -123,7 +124,7 @@ drawitem(struct item *item, int x, int y, int w)
+ else
+ drw_setscheme(drw, scheme[SchemeNorm]);
+
+- return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0);
++ return drw_text(drw, x, y, w, bh, lrpad / 2, item->stext, 0);
+ }
+
+ static void
+@@ -165,7 +166,7 @@ drawmenu(void)
+ }
+ x += w;
+ for (item = curr; item != next; item = item->right)
+- x = drawitem(item, x, 0, MIN(TEXTW(item->text), mw - x - TEXTW(">")));
++ x = drawitem(item, x, 0, MIN(TEXTW(item->stext), mw - x - TEXTW(">")));
+ if (next) {
+ w = TEXTW(">");
+ drw_setscheme(drw, scheme[SchemeNorm]);
+@@ -534,6 +535,10 @@ readstdin(void)
+ *p = '\0';
+ if (!(items[i].text = strdup(buf)))
+ die("cannot strdup %u bytes:", strlen(buf) + 1);
++ if ((p = strchr(buf, '\t')))
++ *p = '\0';
++ if (!(items[i].stext = strdup(buf)))
++ die("cannot strdup %u bytes:", strlen(buf) + 1);
+ items[i].out = 0;
+ drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL);
+ if (tmpmax > inputw) {
+--
+2.28.0
+