bar border - allow for the border size to be explicitly set ref. #364

This commit is contained in:
bakkeby 2023-06-27 16:31:02 +02:00
parent 99f6f1b52c
commit ab7d28ff0f
3 changed files with 16 additions and 8 deletions

View File

@ -7,6 +7,12 @@ static const int corner_radius = 10;
#else
static const unsigned int borderpx = 1; /* border pixel of windows */
#endif // ROUNDED_CORNERS_PATCH
#if BAR_BORDER_PATCH
/* This allows the bar border size to be explicitly set separately from borderpx.
* If left as 0 then it will default to the borderpx value of the monitor and will
* automatically update with setborderpx. */
static const unsigned int barborderpx = 0; /* border pixel of bar */
#endif // BAR_BORDER_PATCH
static const unsigned int snap = 32; /* snap pixel */
#if SWALLOW_PATCH
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */

4
dwm.c
View File

@ -484,7 +484,7 @@ struct Monitor {
int gappov; /* vertical outer gaps */
#endif // VANITYGAPS_PATCH
#if SETBORDERPX_PATCH
unsigned int borderpx;
int borderpx;
#endif // SETBORDERPX_PATCH
unsigned int seltags;
unsigned int sellt;
@ -1676,7 +1676,7 @@ createmon(void)
bar->showbar = 1;
bar->external = 0;
#if BAR_BORDER_PATCH
bar->borderpx = borderpx;
bar->borderpx = (barborderpx ? barborderpx : borderpx);
#else
bar->borderpx = 0;
#endif // BAR_BORDER_PATCH

View File

@ -15,6 +15,7 @@ setborderpx(const Arg *arg)
int delta = 2 * (m->borderpx - prev_borderpx);
#if BAR_BORDER_PATCH
if (!barborderpx) {
for (bar = m->bar; bar; bar = bar->next) {
bar->bh = bar->bh - 2 * bar->borderpx + 2 * m->borderpx;
bar->borderpx = m->borderpx;
@ -22,6 +23,7 @@ setborderpx(const Arg *arg)
updatebarpos(m);
for (bar = m->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
}
#endif // BAR_BORDER_PATCH
for (c = m->clients; c; c = c->next) {