diff options
-rw-r--r-- | config.def.h | 17 | ||||
-rw-r--r-- | config.def.h.orig | 18 | ||||
-rw-r--r-- | config.h | 30 | ||||
-rw-r--r-- | diffs/dmenu-lineheight-5.0.diff | 106 | ||||
-rwxr-xr-x | dmenu | bin | 43520 -> 43552 bytes | |||
-rw-r--r-- | dmenu.1 | 5 | ||||
-rw-r--r-- | dmenu.1.orig | 214 | ||||
-rw-r--r-- | dmenu.c | 9 | ||||
-rw-r--r-- | dmenu.c.orig | 8 | ||||
-rw-r--r-- | dmenu.o | bin | 34480 -> 34528 bytes | |||
-rw-r--r-- | drw.o | bin | 10616 -> 10584 bytes | |||
-rwxr-xr-x | stest | bin | 17080 -> 17080 bytes | |||
-rw-r--r-- | stest.o | bin | 5288 -> 5296 bytes | |||
-rw-r--r-- | util.o | bin | 2256 -> 2256 bytes |
14 files changed, 359 insertions, 48 deletions
diff --git a/config.def.h b/config.def.h index 71594bf..95578e9 100644 --- a/config.def.h +++ b/config.def.h @@ -4,21 +4,24 @@ static int topbar = 0; /* -b option; if 0, dmenu appears at bottom */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { - "Hack:size=11" + "Sauce Code Pro:size=14" }; -static const char *prompt = "Run: ";//NULL; /* -p option; prompt to the left of input field */ +static const char *prompt = "RUN: ";//NULL; /* -p option; prompt to the left of input field */ static const char *colors[SchemeLast][2] = { /* fg bg */ - [SchemeNorm] = { "#FFFFFF", "#171520" }, - [SchemeSel] = { "#FFFFFF", "#D33682" }, - [SchemeSelHighlight] = { "#FFFFFF", "#5B76B7" }, - [SchemeNormHighlight] = { "#FFFFFF", "#130F23" }, - [SchemeMid] = { "#FFFFFF", "#8915e5" }, + [SchemeNorm] = { "#FFFFFF", "#130F23" }, + [SchemeSel] = { "#232627", "#f516a4" }, + [SchemeSelHighlight] = { "#232627", "#9b35e8" }, + [SchemeNormHighlight] = { "#0fe9b0", "#130F23" }, + [SchemeMid] = { "#FFFFFF", "#130F23" }, /*[SchemeNormHighlight] = { "#FFFFFF", "#222222" },*/ [SchemeOut] = { "#FFFFFF", "#5b76b7" }, }; /* -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 = 32; +static unsigned int min_lineheight = 24; /* * Characters not considered part of a word while deleting words diff --git a/config.def.h.orig b/config.def.h.orig index c979baf..a29eaa8 100644 --- a/config.def.h.orig +++ b/config.def.h.orig @@ -1,19 +1,21 @@ /* See LICENSE file for copyright and license details. */ /* Default settings; can be overriden by command line. */ -static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ +static int topbar = 0; /* -b option; if 0, dmenu appears at bottom */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { - "monospace:size=10" + "Sauce Code Pro:size=12" }; -static const char *prompt = NULL; /* -p option; prompt to the left of input field */ +static const char *prompt = "DMENU RUN: ";//NULL; /* -p option; prompt to the left of input field */ static const char *colors[SchemeLast][2] = { /* fg bg */ - [SchemeNorm] = { "#bbbbbb", "#222222" }, - [SchemeSel] = { "#eeeeee", "#005577" }, - [SchemeSelHighlight] = { "#ffc978", "#005577" }, - [SchemeNormHighlight] = { "#ffc978", "#222222" }, - [SchemeOut] = { "#000000", "#00ffff" }, + [SchemeNorm] = { "#FFFFFF", "#171520" }, + [SchemeSel] = { "#FFFFFF", "#D33682" }, + [SchemeSelHighlight] = { "#FFFFFF", "#5B76B7" }, + [SchemeNormHighlight] = { "#FFFFFF", "#130F23" }, + [SchemeMid] = { "#FFFFFF", "#8915e5" }, + /*[SchemeNormHighlight] = { "#FFFFFF", "#222222" },*/ + [SchemeOut] = { "#FFFFFF", "#5b76b7" }, }; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ static unsigned int lines = 0; diff --git a/config.h b/config.h deleted file mode 100644 index 71594bf..0000000 --- a/config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -/* Default settings; can be overriden by command line. */ - -static int topbar = 0; /* -b option; if 0, dmenu appears at bottom */ -/* -fn option overrides fonts[0]; default X11 font or font set */ -static const char *fonts[] = { - "Hack:size=11" -}; -static const char *prompt = "Run: ";//NULL; /* -p option; prompt to the left of input field */ -static const char *colors[SchemeLast][2] = { - /* fg bg */ - [SchemeNorm] = { "#FFFFFF", "#171520" }, - [SchemeSel] = { "#FFFFFF", "#D33682" }, - [SchemeSelHighlight] = { "#FFFFFF", "#5B76B7" }, - [SchemeNormHighlight] = { "#FFFFFF", "#130F23" }, - [SchemeMid] = { "#FFFFFF", "#8915e5" }, - /*[SchemeNormHighlight] = { "#FFFFFF", "#222222" },*/ - [SchemeOut] = { "#FFFFFF", "#5b76b7" }, -}; -/* -l option; if nonzero, dmenu uses vertical list with given number of lines */ -static unsigned int lines = 0; - -/* - * Characters not considered part of a word while deleting words - * for example: " /?\"&[]" - */ -static const char worddelimiters[] = " "; - -/* Size of the window border */ -static unsigned int border_width = 0; diff --git a/diffs/dmenu-lineheight-5.0.diff b/diffs/dmenu-lineheight-5.0.diff new file mode 100644 index 0000000..3b0df3d --- /dev/null +++ b/diffs/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 + Binary files differ@@ -6,6 +6,8 @@ dmenu \- dynamic menu .RB [ \-bfiv ] .RB [ \-l .IR lines ] +.RB [ \-h +.IR height ] .RB [ \-m .IR monitor ] .RB [ \-p @@ -58,6 +60,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.1.orig b/dmenu.1.orig new file mode 100644 index 0000000..472b179 --- /dev/null +++ b/dmenu.1.orig @@ -0,0 +1,214 @@ +.TH DMENU 1 dmenu\-VERSION +.SH NAME +dmenu \- dynamic menu +.SH SYNOPSIS +.B dmenu +.RB [ \-bfiv ] +.RB [ \-l +.IR lines ] +.RB [ \-m +.IR monitor ] +.RB [ \-p +.IR prompt ] +.RB [ \-fn +.IR font ] +.RB [ \-nb +.IR color ] +.RB [ \-nf +.IR color ] +.RB [ \-sb +.IR color ] +.RB [ \-sf +.IR color ] +.RB [ \-nhb +.IR color ] +.RB [ \-nhf +.IR color ] +.RB [ \-shb +.IR color ] +.RB [ \-shf +.IR color ] +.RB [ \-w +.IR windowid ] +.P +.BR dmenu_run " ..." +.SH DESCRIPTION +.B dmenu +is a dynamic menu for X, which reads a list of newline\-separated items from +stdin. When the user selects an item and presses Return, their choice is printed +to stdout and dmenu terminates. Entering text will narrow the items to those +matching the tokens in the input. +.P +.B dmenu_run +is a script used by +.IR dwm (1) +which lists programs in the user's $PATH and runs the result in their $SHELL. +.SH OPTIONS +.TP +.B \-b +dmenu appears at the bottom of the screen. +.TP +.B \-f +dmenu grabs the keyboard before reading stdin if not reading from a tty. This +is faster, but will lock up X until stdin reaches end\-of\-file. +.TP +.B \-i +dmenu matches menu items case insensitively. +.TP +.BI \-l " lines" +dmenu lists items vertically, with the given number of lines. +.TP +.BI \-m " monitor" +dmenu is displayed on the monitor number supplied. Monitor numbers are starting +from 0. +.TP +.BI \-p " prompt" +defines the prompt to be displayed to the left of the input field. +.TP +.BI \-fn " font" +defines the font or font set used. +.TP +.BI \-nb " color" +defines the normal background color. +.IR #RGB , +.IR #RRGGBB , +and X color names are supported. +.TP +.BI \-nf " color" +defines the normal foreground color. +.TP +.BI \-sb " color" +defines the selected background color. +.TP +.BI \-sf " color" +defines the selected foreground color. +.TP +.BI \-nhb " color" +defines the normal highlight background color. +.TP +.BI \-nhf " color" +defines the normal highlight foreground color. +.TP +.BI \-shb " color" +defines the selected highlight background color. +.TP +.BI \-shf " color" +defines the selected highlight foreground color. +.TP +.B \-v +prints version information to stdout, then exits. +.TP +.BI \-w " windowid" +embed into windowid. +.SH USAGE +dmenu is completely controlled by the keyboard. Items are selected using the +arrow keys, page up, page down, home, and end. +.TP +.B Tab +Copy the selected item to the input field. +.TP +.B Return +Confirm selection. Prints the selected item to stdout and exits, returning +success. +.TP +.B Ctrl-Return +Confirm selection. Prints the selected item to stdout and continues. +.TP +.B Shift\-Return +Confirm input. Prints the input text to stdout and exits, returning success. +.TP +.B Escape +Exit without selecting an item, returning failure. +.TP +.B Ctrl-Left +Move cursor to the start of the current word +.TP +.B Ctrl-Right +Move cursor to the end of the current word +.TP +.B C\-a +Home +.TP +.B C\-b +Left +.TP +.B C\-c +Escape +.TP +.B C\-d +Delete +.TP +.B C\-e +End +.TP +.B C\-f +Right +.TP +.B C\-g +Escape +.TP +.B C\-h +Backspace +.TP +.B C\-i +Tab +.TP +.B C\-j +Return +.TP +.B C\-J +Shift-Return +.TP +.B C\-k +Delete line right +.TP +.B C\-m +Return +.TP +.B C\-M +Shift-Return +.TP +.B C\-n +Down +.TP +.B C\-p +Up +.TP +.B C\-u +Delete line left +.TP +.B C\-w +Delete word left +.TP +.B C\-y +Paste from primary X selection +.TP +.B C\-Y +Paste from X clipboard +.TP +.B M\-b +Move cursor to the start of the current word +.TP +.B M\-f +Move cursor to the end of the current word +.TP +.B M\-g +Home +.TP +.B M\-G +End +.TP +.B M\-h +Up +.TP +.B M\-j +Page down +.TP +.B M\-k +Page up +.TP +.B M\-l +Down +.SH SEE ALSO +.IR dwm (1), +.IR stest (1) @@ -182,7 +182,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); @@ -199,7 +199,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) { @@ -660,6 +660,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 @@ -771,6 +772,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/dmenu.c.orig b/dmenu.c.orig index 9497736..1bd6b76 100644 --- a/dmenu.c.orig +++ b/dmenu.c.orig @@ -26,9 +26,13 @@ #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) /* enums */ +// <<<<<<< enum { SchemeNorm, SchemeSel, SchemeNormHighlight, SchemeSelHighlight, - SchemeOut, SchemeLast }; /* color schemes */ + SchemeOut, SchemeMid, SchemeLast }; /* color schemes */ +// ======= +// enum { SchemeNorm, SchemeSel, SchemeOut, SchemeMid, SchemeLast }; /* color schemes */ +// >>>>>>> struct item { char *text; @@ -161,6 +165,8 @@ drawitem(struct item *item, int x, int y, int w) int r; if (item == sel) drw_setscheme(drw, scheme[SchemeSel]); + else if (item->left == sel || item->right == sel) + drw_setscheme(drw, scheme[SchemeMid]); else if (item->out) drw_setscheme(drw, scheme[SchemeOut]); else Binary files differBinary files differBinary files differBinary files differBinary files differ |