dwm

my customized dwm build
git clone git://git.hanetzok.net/dwm
Log | Files | Refs | README | LICENSE

commit e61ad0267809ec7450779ed0dfa69b9736e4ef2d
parent 08fb664812eec2fcfbf19dfcd6eb72b0a2ef5e52
Author: Markus Hanetzok <markus@hanetzok.net>
Date:   Mon, 27 Oct 2025 12:46:35 +0100

apply barpadding patch

Diffstat:
Mconfig.def.h | 2++
Mdwm.c | 27++++++++++++++++-----------
2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -18,6 +18,8 @@ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const int horizpadbar = 2; /* horizontal padding for statusbar */ static const int vertpadbar = 3; /* vertical padding for statusbar */ +static const int vertpad = 10; /* vertical padding of bar */ +static const int sidepad = 10; /* horizontal padding of bar */ static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; static char normbgcolor[] = "#222222"; diff --git a/dwm.c b/dwm.c @@ -330,6 +330,8 @@ static int enablegaps = 1; /* enables gaps, used by togglegaps */ static int sw, sh; /* X display screen geometry width, height */ static int bh; /* bar height */ static int lrpad; /* sum of left and right padding for text */ +static int vp; /* vertical padding for bar */ +static int sp; /* side padding for bar */ static int (*xerrorxlib)(Display *, XErrorEvent *); static unsigned int numlockmask = 0; static void (*handler[LASTEvent]) (XEvent *) = { @@ -927,8 +929,8 @@ drawbar(Monitor *m) /* draw status first so it can be overdrawn by tags later */ if (m == selmon) { /* status is only drawn on selected monitor */ drw_setscheme(drw, scheme[SchemeNorm]); - tw = TEXTW(stext); - drw_text(drw, m->ww - tw, 0, tw, bh, lrpad / 2, stext, 0); + tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ + drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0); } resizebarwin(m); @@ -955,12 +957,12 @@ drawbar(Monitor *m) if ((w = m->ww - tw - stw - x) > bh) { if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); + drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0); if (m->sel->isfloating) drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); } else { drw_setscheme(drw, scheme[SchemeNorm]); - drw_rect(drw, x, 0, w, bh, 1, 1); + drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1); } } drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh); @@ -1593,7 +1595,7 @@ resizebarwin(Monitor *m) { unsigned int w = m->ww; if (showsystray && m == systraytomon(m) && !systrayonleft) w -= getsystraywidth(); - XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh); + XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, w -2 * sp, bh); } void @@ -2083,7 +2085,10 @@ setup(void) die("no fonts could be loaded."); lrpad = drw->fonts->h + horizpadbar; bh = drw->fonts->h + vertpadbar; + sp = sidepad; + vp = (topbar == 1) ? vertpad : - vertpad; updategeom(); + /* init atoms */ utf8string = XInternAtom(dpy, "UTF8_STRING", False); wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); @@ -2431,7 +2436,7 @@ updatebars(void) w = m->ww; if (showsystray && m == systraytomon(m)) w -= getsystraywidth(); - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen), + m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); @@ -2448,11 +2453,11 @@ updatebarpos(Monitor *m) m->wy = m->my; m->wh = m->mh; if (m->showbar) { - m->wh -= bh; - m->by = m->topbar ? m->wy : m->wy + m->wh; - m->wy = m->topbar ? m->wy + bh : m->wy; + m->wh = m->wh - vertpad - bh; + m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad; + m->wy = m->topbar ? m->wy + bh + vp : m->wy; } else - m->by = -bh; + m->by = -bh - vp; } void @@ -2722,7 +2727,7 @@ updatesystray(void) } w = w ? w + systrayspacing : 1; x -= w; - XMoveResizeWindow(dpy, systray->win, x, m->by, w, bh); + XMoveResizeWindow(dpy, systray->win, x - sp, m->by + vp, w, bh); wc.x = x; wc.y = m->by; wc.width = w; wc.height = bh; wc.stack_mode = Above; wc.sibling = m->barwin; XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);