dmenu

dynamic menu
git clone git://mfeller.io/dmenu.git
Log | Files | Refs | README | LICENSE

commit 12a5dc27fa5afa0c499f1f92f4b94bc56bd27882
parent 9d63e0b5e4eca28e156dfe6f036df5d031fb9af4
Author: Mark Feller <mark@getsunday.com>
Date:   Mon, 22 Feb 2021 08:25:02 -0700

tweak border logic and color schemes

Diffstat:
Mconfig.def.h | 11++++++-----
Mdmenu.c | 8++++----
Mdmenu_run | 2+-
3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -6,14 +6,15 @@ static int centered = 0; /* -c option; centers dmenu on scree static int min_width = 500; /* minimum width when centered */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { - "Fira Mono:size=11" + "Fira Mono:size=10" }; static const char *prompt = NULL; /* -p option; prompt to the left of input field */ static const char *colors[SchemeLast][2] = { /* fg bg */ - [SchemeNorm] = { "#ebdbb2", "#161819" }, - [SchemeSel] = { "#268bd2", "#1d2021" }, - [SchemeOut] = { "#000000", "#161819" }, + [SchemeNorm] = { "#ebdbb2", "#161819" }, + [SchemeSel] = { "#98971a", "#1d2021" }, + [SchemeOut] = { "#000000", "#161819" }, + [SchemeBorder] = { "#000000", "#aaaaaa" }, }; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ static unsigned int lines = 0; @@ -26,4 +27,4 @@ static unsigned int lineheight = 25; /* -h option; minimum height of a m static const char worddelimiters[] = " "; /* Size of the window border */ -static unsigned int border_width = 10; +static unsigned int border_width = 2; diff --git a/dmenu.c b/dmenu.c @@ -26,7 +26,7 @@ #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) /* enums */ -enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ +enum { SchemeNorm, SchemeSel, SchemeOut, SchemeBorder, SchemeLast }; /* color schemes */ struct item { char *text; @@ -157,7 +157,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 + (bh-fh)/2, 2, bh - 4, 1, 0); + drw_rect(drw, x + curpos, 2 + (bh-fh)/2, 2, 14, 1, 0); } if (lines > 0) { @@ -694,11 +694,11 @@ setup(void) swa.override_redirect = True; swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; - win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, + win = XCreateWindow(dpy, parentwin, x-border_width, y-border_width, mw, mh, border_width, CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); if (border_width) - XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); + XSetWindowBorder(dpy, win, scheme[SchemeBorder][ColBg].pixel); XSetClassHint(dpy, win, &ch); diff --git a/dmenu_run b/dmenu_run @@ -1,2 +1,2 @@ #!/bin/sh -dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & +dmenu_path | dmenu -i -h 40 "$@" | ${SHELL:-"/bin/sh"} &