From d4ba5053cecc084022c72c4a3faa288763ecf50d Mon Sep 17 00:00:00 2001 From: bakkeby Date: Mon, 14 Mar 2022 11:26:51 +0100 Subject: [PATCH] border patch: adding separate colour scheme for the border (rather than forcing SchemeSel) --- config.def.h | 24 ++++++++++++++++++++++++ dmenu.c | 5 ++++- patch/xresources.c | 4 ++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index d4db7c3..8777fef 100644 --- a/config.def.h +++ b/config.def.h @@ -54,6 +54,27 @@ static const unsigned int alphas[][3] = { /* fg bg border */ [SchemeNorm] = { OPAQUE, baralpha, borderalpha }, [SchemeSel] = { OPAQUE, baralpha, borderalpha }, + #if BORDER_PATCH + [SchemeBorder] = { OPAQUE, OPAQUE, OPAQUE }, + #endif // BORDER_PATCH + #if MORECOLOR_PATCH + [SchemeMid] = { OPAQUE, baralpha, borderalpha }, + #endif // MORECOLOR_PATCH + #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH + [SchemeSelHighlight] = { OPAQUE, baralpha, borderalpha }, + [SchemeNormHighlight] = { OPAQUE, baralpha, borderalpha }, + #endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH + #if HIGHPRIORITY_PATCH + [SchemeHp] = { OPAQUE, baralpha, borderalpha }, + #endif // HIGHPRIORITY_PATCH + #if EMOJI_HIGHLIGHT_PATCH + [SchemeHover] = { OPAQUE, baralpha, borderalpha }, + [SchemeGreen] = { OPAQUE, baralpha, borderalpha }, + [SchemeRed] = { OPAQUE, baralpha, borderalpha }, + [SchemeYellow] = { OPAQUE, baralpha, borderalpha }, + [SchemeBlue] = { OPAQUE, baralpha, borderalpha }, + [SchemePurple] = { OPAQUE, baralpha, borderalpha }, + #endif // EMOJI_HIGHLIGHT_PATCH }; #endif // ALPHA_PATCH @@ -66,6 +87,9 @@ char *colors[][2] = { [SchemeNorm] = { "#bbbbbb", "#222222" }, [SchemeSel] = { "#eeeeee", "#005577" }, [SchemeOut] = { "#000000", "#00ffff" }, + #if BORDER_PATCH + [SchemeBorder] = { "#000000", "#005577" }, + #endif // BORDER_PATCH #if MORECOLOR_PATCH [SchemeMid] = { "#eeeeee", "#770000" }, #endif // MORECOLOR_PATCH diff --git a/dmenu.c b/dmenu.c index 2f0c881..241b276 100644 --- a/dmenu.c +++ b/dmenu.c @@ -59,6 +59,9 @@ enum { SchemeNorm, SchemeSel, SchemeOut, + #if BORDER_PATCH + SchemeBorder, + #endif // BORDER_PATCH #if MORECOLOR_PATCH SchemeMid, #endif // MORECOLOR_PATCH @@ -1684,7 +1687,7 @@ setup(void) ); #if BORDER_PATCH if (border_width) - XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); + XSetWindowBorder(dpy, win, scheme[SchemeBorder][ColBg].pixel); #endif // BORDER_PATCH XSetClassHint(dpy, win, &ch); #if WMTYPE_PATCH diff --git a/patch/xresources.c b/patch/xresources.c index 21cf550..cdb1631 100644 --- a/patch/xresources.c +++ b/patch/xresources.c @@ -39,6 +39,10 @@ readxresources(void) if (XrmGetResource(xdb, "dmenu.midforeground", "*", &type, &xval)) colors[SchemeMid][ColFg] = strdup(xval.addr); #endif // MORECOLOR_PATCH + #if BORDER_PATCH + if (XrmGetResource(xdb, "dmenu.bordercolor", "*", &type, &xval)) + colors[SchemeBorder][ColBg] = strdup(xval.addr); + #endif // BORDER_PATCH #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH if (XrmGetResource(xdb, "dmenu.selhlbackground", "*", &type, &xval)) colors[SchemeSelHighlight][ColBg] = strdup(xval.addr);