diff --git a/README.md b/README.md index bbce9f2..17055a3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2020-01-24 - Added barpadding patch (incl. statusallmons, statuspadding, statuscolors, systray, alpha and extrabar patch compatibility). Moved patches.h to patches.def.h to mimic the config pattern of having default and personal settings. +2020-01-24 - Added barpadding patch (incl. statusallmons, statuspadding, statuscolors, systray, alpha, holdbar and extrabar patch compatibility). Moved patches.h to patches.def.h to mimic the config pattern of having default and personal settings. 2020-01-17 - Added inplacerotate patch diff --git a/dwm.c b/dwm.c index fba0c82..2f1b0a7 100644 --- a/dwm.c +++ b/dwm.c @@ -1063,7 +1063,7 @@ configurenotify(XEvent *e) #endif // BARPADDING_PATCH #if EXTRABAR_PATCH #if BARPADDING_PATCH - XMoveResizeWindow(dpy, m->extrabarwin, m->wx, m->eby - vp, m->ww - 2 * sp, bh); + XMoveResizeWindow(dpy, m->extrabarwin, m->wx + sp, m->eby - vp, m->ww - 2 * sp, bh); #else XMoveResizeWindow(dpy, m->extrabarwin, m->wx, m->eby, m->ww, bh); #endif // BARPADDING_PATCH diff --git a/patch/holdbar.c b/patch/holdbar.c index 0ea1d41..ccf662f 100644 --- a/patch/holdbar.c +++ b/patch/holdbar.c @@ -3,7 +3,18 @@ holdbar(const Arg *arg) { selmon->showbar = 1; updateholdbarpos(selmon); + #if BARPADDING_PATCH + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh); + #else XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); + #endif // BARPADDING_PATCH + #if EXTRABAR_PATCH + #if BARPADDING_PATCH + XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx + sp, selmon->eby - vp, selmon->ww - 2 * sp, bh); + #else + XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx, selmon->eby, selmon->ww, bh); + #endif // BARPADDING_PATCH + #endif // EXTRABAR_PATCH } void @@ -12,7 +23,18 @@ keyrelease(XEvent *e) if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)) { selmon->showbar = 0; updateholdbarpos(selmon); + #if BARPADDING_PATCH + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh); + #else XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); + #endif // BARPADDING_PATCH + #if EXTRABAR_PATCH + #if BARPADDING_PATCH + XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx + sp, selmon->eby - vp, selmon->ww - 2 * sp, bh); + #else + XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx, selmon->eby, selmon->ww, bh); + #endif // BARPADDING_PATCH + #endif // EXTRABAR_PATCH arrange(selmon); } #if COMBO_PATCH @@ -25,10 +47,47 @@ updateholdbarpos(Monitor *m) { m->wy = m->my; m->wh = m->mh; + // if (m->showbar) { + // m->by = m->topbar ? m->wy : m->wy + m->wh - bh; + // m->wy = m->topbar ? m->wy - bh + bh : m->wy; + // } else { + // m->by = -bh; + // } + #if EXTRABAR_PATCH + #if BARPADDING_PATCH + m->wh = m->wh - vertpad * m->showbar * 2 - bh * m->showbar * 2; + m->wy = m->showbar ? m->wy + bh + vertpad: m->wy; if (m->showbar) { - m->by = m->topbar ? m->wy : m->wy + m->wh - bh; - m->wy = m->topbar ? m->wy - bh + bh : m->wy; + m->by = m->topbar ? m->wy - bh - vertpad: m->wy + m->wh + vertpad; + m->eby = m->topbar ? m->wy + m->wh + vertpad: m->wy - bh - vertpad; + } else { + m->by = -bh - vertpad; + m->eby = -bh - vertpad; + } + #else + m->wh = m->wh - bh * m->showbar * 2; + m->wy = m->showbar ? m->wy + bh : m->wy; + if (m->showbar) { + m->by = m->topbar ? m->wy - bh : m->wy + m->wh; + m->eby = m->topbar ? m->wy + m->wh : m->wy - bh; } else { m->by = -bh; + m->eby = -bh; } + #endif // BARPADDING_PATCH + #elif BARPADDING_PATCH + if (m->showbar) { + 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 - vp; + #else + 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; + } else + m->by = -bh; + #endif // EXTRABAR_PATCH } \ No newline at end of file