From 8f401e1d81862333b453bb1b184caded6ee643f8 Mon Sep 17 00:00:00 2001 From: Utkarsh Verma Date: Sun, 26 Dec 2021 18:29:55 +0530 Subject: [PATCH] Add a new patch to integrate vanity gaps with bar padding --- dwm.c | 9 ++++++++- patch/vanitygaps.c | 10 ++++++++++ patches.def.h | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dwm.c b/dwm.c index 70ef5e7..938ba0e 100644 --- a/dwm.c +++ b/dwm.c @@ -4319,7 +4319,14 @@ updatebarpos(Monitor *m) m->ww = m->mw; m->wh = m->mh; Bar *bar; - #if BAR_PADDING_PATCH + #if BAR_GAPS_PADDING_PATCH + int y_pad = 0; + int x_pad = 0; + if (enablegaps) { + y_pad = gappov; + x_pad = gappoh; + } + #elif BAR_PADDING_PATCH int y_pad = vertpad; int x_pad = sidepad; #else diff --git a/patch/vanitygaps.c b/patch/vanitygaps.c index be2ef08..757aa4d 100644 --- a/patch/vanitygaps.c +++ b/patch/vanitygaps.c @@ -86,6 +86,16 @@ togglegaps(const Arg *arg) #else enablegaps = !enablegaps; #endif // PERTAG_VANITYGAPS_PATCH + + #if BAR_GAPS_PADDING_PATCH + updatebarpos(selmon); + Bar *bar = selmon->bar; + XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw + gappoh, bar->bh); + + #if BAR_SYSTRAY_PATCH + drawbarwin(systray->bar); + #endif // BAR_SYSTRAY_PATCH + #endif // BAR_GAPS_PADDING_PATCH arrange(NULL); } diff --git a/patches.def.h b/patches.def.h index 022a4a6..037c5ee 100644 --- a/patches.def.h +++ b/patches.def.h @@ -347,6 +347,12 @@ */ #define BAR_PADDING_PATCH 0 +/* Same as barpadding patch but specifically written for the vanitygaps patch. It adds the same + * outer horizontal and vertical padding as vanity gaps. Moreover, the padding is toggled whenever + * vanitygaps are toggled. + */ +#define BAR_GAPS_PADDING_PATCH 0 + /* This patch adds simple markup for status messages using pango markup. * This depends on the pango library v1.44 or greater. * You need to uncomment the corresponding lines in config.mk to use the pango libraries