Holdbar compatibility with barpadding, extrabar and statuspadding.

This commit is contained in:
bakkeby 2020-01-24 20:41:08 +01:00
parent d04b3899fd
commit fa6e3d9500
3 changed files with 63 additions and 4 deletions

View File

@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog: ### 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 2020-01-17 - Added inplacerotate patch

2
dwm.c
View File

@ -1063,7 +1063,7 @@ configurenotify(XEvent *e)
#endif // BARPADDING_PATCH #endif // BARPADDING_PATCH
#if EXTRABAR_PATCH #if EXTRABAR_PATCH
#if BARPADDING_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 #else
XMoveResizeWindow(dpy, m->extrabarwin, m->wx, m->eby, m->ww, bh); XMoveResizeWindow(dpy, m->extrabarwin, m->wx, m->eby, m->ww, bh);
#endif // BARPADDING_PATCH #endif // BARPADDING_PATCH

View File

@ -3,7 +3,18 @@ holdbar(const Arg *arg)
{ {
selmon->showbar = 1; selmon->showbar = 1;
updateholdbarpos(selmon); 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); 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 void
@ -12,7 +23,18 @@ keyrelease(XEvent *e)
if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)) { if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)) {
selmon->showbar = 0; selmon->showbar = 0;
updateholdbarpos(selmon); 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); 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); arrange(selmon);
} }
#if COMBO_PATCH #if COMBO_PATCH
@ -25,10 +47,47 @@ updateholdbarpos(Monitor *m)
{ {
m->wy = m->my; m->wy = m->my;
m->wh = m->mh; 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) { if (m->showbar) {
m->by = m->topbar ? m->wy : m->wy + m->wh - bh; m->by = m->topbar ? m->wy - bh - vertpad: m->wy + m->wh + vertpad;
m->wy = m->topbar ? m->wy - bh + bh : m->wy; 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 { } else {
m->by = -bh; 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
} }