diff --git a/README.org b/README.org index 98e1f24..4ed9c98 100644 --- a/README.org +++ b/README.org @@ -1150,7 +1150,6 @@ Awesomebar takes precedence over fancybar. https://dwm.suckless.org/patches/awesomebar/ - #+BEGIN_SRC c :tangle patches.def.h #define BAR_AWESOMEBAR_PATCH 0 #+END_SRC @@ -1682,6 +1681,8 @@ This patch adds back in the workaround for a BadLength error in the Xft library *** Padding +**** Main + This patch adds vertical and horizontal space between the statusbar and the edge of the screen. https://dwm.suckless.org/patches/barpadding/ @@ -1690,6 +1691,22 @@ https://dwm.suckless.org/patches/barpadding/ #define BAR_PADDING_PATCH 0 #+END_SRC +**** Vanity Gaps + +Same as barpadding patch but specifically tailored for the vanitygaps patch in that the outer bar padding is derived from the vanitygaps settings. In addition to this the bar padding is toggled in unison when vanitygaps are toggled. Increasing or decreasing gaps during runtime will not affect the bar padding. + +#+BEGIN_SRC c :tangle patches.def.h +#define BAR_PADDING_VANITYGAPS_PATCH 0 +#+END_SRC + +**** Smart + +Smart bar padding patch that automatically adjusts the padding when there is only one client on the monitor. Works well with vanitygaps and barpadding patches. + +#+BEGIN_SRC c :tangle patches.def.h +#define BAR_PADDING_SMART_PATCH 0 +#+END_SRC + *** Pango This patch adds simple markup for status messages using pango markup. diff --git a/dwm.c b/dwm.c index 543b721..f4e52f0 100644 --- a/dwm.c +++ b/dwm.c @@ -688,6 +688,9 @@ static void maprequest(XEvent *e); static void motionnotify(XEvent *e); static void movemouse(const Arg *arg); static Client *nexttiled(Client *c); +#if NOBORDER_PATCH +static int noborder(Client *c); +#endif // NOBORDER_PATCH #if !ZOOMSWAP_PATCH || TAGINTOSTACK_ALLMASTER_PATCH || TAGINTOSTACK_ONEMASTER_PATCH static void pop(Client *c); #endif // !ZOOMSWAP_PATCH / TAGINTOSTACK_ALLMASTER_PATCH / TAGINTOSTACK_ONEMASTER_PATCH @@ -1108,6 +1111,11 @@ arrange(Monitor *m) void arrangemon(Monitor *m) { + #if BAR_PADDING_SMART_PATCH + updatebarpos(selmon); + for (Bar *bar = selmon->bar; bar; bar = bar->next) + XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh); + #endif // BAR_PADDING_SMART_PATCH #if TAB_PATCH updatebarpos(m); XMoveResizeWindow(dpy, m->tabwin, m->wx, m->ty, m->ww, th); @@ -1461,6 +1469,15 @@ configure(Client *c) ce.width = c->w; ce.height = c->h; ce.border_width = c->bw; + + #if NOBORDER_PATCH + if (noborder(c)) { + ce.width += c->bw * 2; + ce.height += c->bw * 2; + ce.border_width = 0; + } + #endif // NOBORDER_PATCH + ce.above = None; ce.override_redirect = False; XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce); @@ -2857,6 +2874,52 @@ nexttiled(Client *c) return c; } +#if NOBORDER_PATCH +int +noborder(Client *c) +{ + int monocle_layout = 0; + + #if MONOCLE_LAYOUT + if (&monocle == c->mon->lt[c->mon->sellt]->arrange) + monocle_layout = 1; + #endif // MONOCLE_LAYOUT + + #if DECK_LAYOUT + if (&deck == c->mon->lt[c->mon->sellt]->arrange && c->mon->nmaster == 0) + monocle_layout = 1; + #endif // DECK_LAYOUT + + #if FLEXTILE_DELUXE_LAYOUT + if (&flextile == c->mon->lt[c->mon->sellt]->arrange && ( + (c->mon->ltaxis[LAYOUT] == NO_SPLIT && c->mon->ltaxis[MASTER] == MONOCLE) || + (c->mon->ltaxis[STACK] == MONOCLE && c->mon->nmaster == 0) + )) { + monocle_layout = 1; + } + #endif //FLEXTILE_DELUXE_LAYOUT + + if (!monocle_layout && (nexttiled(c->mon->clients) != c || nexttiled(c->next))) + return 0; + + if (c->isfloating) + return 0; + + if (!c->mon->lt[c->mon->sellt]->arrange) + return 0; + + #if FAKEFULLSCREEN_CLIENT_PATCH && !FAKEFULLSCREEN_PATCH + if (c->fakefullscreen != 1 && c->isfullscreen) + return 0; + #elif !FAKEFULLSCREEN_PATCH + if (c->isfullscreen) + return 0; + #endif // FAKEFULLSCREEN_CLIENT_PATCH + + return 1; +} +#endif // NOBORDER_PATCH + #if !ZOOMSWAP_PATCH || TAGINTOSTACK_ALLMASTER_PATCH || TAGINTOSTACK_ONEMASTER_PATCH void pop(Client *c) @@ -3011,31 +3074,9 @@ resizeclient(Client *c, int x, int y, int w, int h) drawroundedcorners(c); #endif // ROUNDED_CORNERS_PATCH #if NOBORDER_PATCH - if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) - #if MONOCLE_LAYOUT - || &monocle == c->mon->lt[c->mon->sellt]->arrange - #endif // MONOCLE_LAYOUT - #if DECK_LAYOUT - || (&deck == c->mon->lt[c->mon->sellt]->arrange && - c->mon->nmaster == 0) - #endif // DECK_LAYOUT - #if FLEXTILE_DELUXE_LAYOUT - || (&flextile == c->mon->lt[c->mon->sellt]->arrange && ( - (c->mon->ltaxis[LAYOUT] == NO_SPLIT && - c->mon->ltaxis[MASTER] == MONOCLE) || - (c->mon->ltaxis[STACK] == MONOCLE && - c->mon->nmaster == 0))) - #endif //FLEXTILE_DELUXE_LAYOUT - ) - #if FAKEFULLSCREEN_CLIENT_PATCH && !FAKEFULLSCREEN_PATCH - && (c->fakefullscreen == 1 || !c->isfullscreen) - #else - && !c->isfullscreen - #endif // FAKEFULLSCREEN_CLIENT_PATCH - && !c->isfloating - && c->mon->lt[c->mon->sellt]->arrange) { - c->w = wc.width += c->bw * 2; - c->h = wc.height += c->bw * 2; + if (noborder(c)) { + wc.width += c->bw * 2; + wc.height += c->bw * 2; wc.border_width = 0; } #endif // NOBORDER_PATCH @@ -4664,12 +4705,30 @@ updatebarpos(Monitor *m) if (enablegaps) #endif // PERTAG_VANITYGAPS_PATCH { + #if BAR_PADDING_SMART_PATCH + unsigned int n; Client *c; + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if (n > 1) { + y_pad = gappoh; + x_pad = gappov; + } + #else y_pad = gappoh; x_pad = gappov; + #endif // BAR_PADDING_SMART_PATCH } #elif BAR_PADDING_PATCH + #if BAR_PADDING_SMART_PATCH + unsigned int n; Client *c; + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if (n > 1) { + y_pad = vertpad; + x_pad = sidepad; + } + #else y_pad = vertpad; x_pad = sidepad; + #endif // BAR_PADDING_SMART_PATCH #endif // BAR_PADDING_PATCH | BAR_PADDING_VANITYGAPS_PATCH #if INSETS_PATCH diff --git a/patches.def.h b/patches.def.h index 5de2f00..4fc5624 100644 --- a/patches.def.h +++ b/patches.def.h @@ -91,6 +91,10 @@ #define BAR_PADDING_PATCH 0 +#define BAR_PADDING_VANITYGAPS_PATCH 0 + +#define BAR_PADDING_SMART_PATCH 0 + #define BAR_PANGO_PATCH 0 #define BAR_STATICSTATUS_PATCH 0