dmenu-bordercolor-20230512-0fe460d.diff (2337B)
1 From 8dbea77ad7b320d9c7e07990274ea74835785084 Mon Sep 17 00:00:00 2001 2 From: Markus Hanetzok <markus@hanetzok.net> 3 Date: Sun, 14 May 2023 01:04:09 +0200 4 Subject: [PATCH] Makes border colors independent from SelBg 5 --- 6 config.def.h | 5 +++++ 7 dmenu.c | 9 +++++++-- 8 2 files changed, 12 insertions(+), 2 deletions(-) 9 10 diff --git a/config.def.h b/config.def.h 11 index 1edb647..ae41b06 100644 12 --- a/config.def.h 13 +++ b/config.def.h 14 @@ -12,6 +12,7 @@ static const char *colors[SchemeLast][2] = { 15 [SchemeNorm] = { "#bbbbbb", "#222222" }, 16 [SchemeSel] = { "#eeeeee", "#005577" }, 17 [SchemeOut] = { "#000000", "#00ffff" }, 18 + [SchemeBorder] = { "#cccccc", NULL }, 19 }; 20 /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ 21 static unsigned int lines = 0; 22 @@ -21,3 +22,7 @@ static unsigned int lines = 0; 23 * for example: " /?\"&[]" 24 */ 25 static const char worddelimiters[] = " "; 26 + 27 +/* Size of the window border */ 28 +static unsigned int border_width = 0; 29 + 30 diff --git a/dmenu.c b/dmenu.c 31 index 62f1089..7f063b6 100644 32 --- a/dmenu.c 33 +++ b/dmenu.c 34 @@ -26,7 +26,7 @@ 35 #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 36 37 /* enums */ 38 -enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ 39 +enum { SchemeNorm, SchemeSel, SchemeOut, SchemeBorder, SchemeLast }; /* color schemes */ 40 41 struct item { 42 char *text; 43 @@ -685,9 +685,11 @@ setup(void) 44 swa.override_redirect = True; 45 swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; 46 swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; 47 - win = XCreateWindow(dpy, root, x, y, mw, mh, 0, 48 + win = XCreateWindow(dpy, root, x, y, mw, mh, border_width, 49 CopyFromParent, CopyFromParent, CopyFromParent, 50 CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); 51 + if (border_width) 52 + XSetWindowBorder(dpy, win, scheme[SchemeBorder][ColFg].pixel); 53 XSetClassHint(dpy, win, &ch); 54 55 56 @@ -759,6 +761,8 @@ main(int argc, char *argv[]) 57 colors[SchemeSel][ColFg] = argv[++i]; 58 else if (!strcmp(argv[i], "-w")) /* embedding window id */ 59 embed = argv[++i]; 60 + else if (!strcmp(argv[i], "-bw")) 61 + border_width = atoi(argv[++i]); /* border width */ 62 else 63 usage(); 64 65 @@ -795,3 +799,4 @@ main(int argc, char *argv[]) 66 67 return 1; /* unreachable */ 68 } 69 + 70 -- 71 2.40.1