From f4d516ba8c6f799ce01dd98456e274ae21e596bd Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Sat, 31 May 2025 23:18:53 +0200 Subject: update --- README.md | 3 +-- config.def.h | 1 + config.h | 1 + dmenu.c | 20 +++++++++++++------- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8a8804a..fa8d31a 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,8 @@ - xresources - center -- border The center patch adds the -c parameter for centering dmenu -The border patch adds the -bw parameter followed by an integer The xresources patch makes dmenu read the .Xresources file enabling
on the fly color matching with Pywal16 @@ -17,3 +15,4 @@ on the fly color matching with Pywal16 dmenu.foreground: {color15} dmenu.selbackground: {color0} dmenu.selforeground: {color15} + dmenu.border: {color4} diff --git a/config.def.h b/config.def.h index ad38804..d27a5d8 100644 --- a/config.def.h +++ b/config.def.h @@ -14,6 +14,7 @@ static const char *colors[SchemeLast][2] = { [SchemeNorm] = { "#bbbbbb", "#222222" }, [SchemeSel] = { "#eeeeee", "#005577" }, [SchemeOut] = { "#000000", "#00ffff" }, + [SchemeBorder] = { "#cccccc", NULL }, }; /* -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 index ad38804..d27a5d8 100644 --- a/config.h +++ b/config.h @@ -14,6 +14,7 @@ static const char *colors[SchemeLast][2] = { [SchemeNorm] = { "#bbbbbb", "#222222" }, [SchemeSel] = { "#eeeeee", "#005577" }, [SchemeOut] = { "#000000", "#00ffff" }, + [SchemeBorder] = { "#cccccc", NULL }, }; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ static unsigned int lines = 0; diff --git a/dmenu.c b/dmenu.c index 97d0c90..357ba4f 100644 --- 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; @@ -54,7 +54,7 @@ static Drw *drw; static Clr *scheme[SchemeLast]; /* Temporary arrays to allow overriding xresources values */ -static char *colortemp[4]; +static char *colortemp[5]; static char *tempfonts; #include "config.h" @@ -722,7 +722,7 @@ setup(void) CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); if (border_width) - XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); + XSetWindowBorder(dpy, win, scheme[SchemeBorder][ColFg].pixel); XSetClassHint(dpy, win, &ch); /* input methods */ @@ -784,6 +784,10 @@ readxresources(void) { colors[SchemeSel][ColFg] = strdup(xval.addr); else colors[SchemeSel][ColFg] = strdup(colors[SchemeSel][ColFg]); + if (XrmGetResource(xdb, "dmenu.border", "*", &type, &xval)) + colors[SchemeBorder][ColFg] = strdup(xval.addr); + else + colors[SchemeBorder][ColFg] = strdup(colors[SchemeBorder][ColFg]); XrmDestroyDatabase(xdb); } @@ -852,13 +856,15 @@ main(int argc, char *argv[]) if ( tempfonts ) fonts[0] = strdup(tempfonts); if ( colortemp[0]) - colors[SchemeNorm][ColBg] = strdup(colortemp[0]); + colors[SchemeNorm][ColBg] = strdup(colortemp[0]); if ( colortemp[1]) - colors[SchemeNorm][ColFg] = strdup(colortemp[1]); + colors[SchemeNorm][ColFg] = strdup(colortemp[1]); if ( colortemp[2]) - colors[SchemeSel][ColBg] = strdup(colortemp[2]); + colors[SchemeSel][ColBg] = strdup(colortemp[2]); if ( colortemp[3]) - colors[SchemeSel][ColFg] = strdup(colortemp[3]); + colors[SchemeSel][ColFg] = strdup(colortemp[3]); + if ( colortemp[4]) + colors[SchemeBorder][ColFg] = strdup(colortemp[4]); if (!drw_fontset_create(drw, (const char**)fonts, LENGTH(fonts))) die("no fonts could be loaded."); -- cgit v1.2.3