From 8c07458f1166d771fbb81039bf474b01fcc2f0a2 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 30 Jun 2020 10:15:36 +0200 Subject: [PATCH] holdbar: toggle bar improvements --- dwm.c | 8 ++++++-- patch/holdbar.c | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dwm.c b/dwm.c index 87e3fa7..782ef3d 100644 --- a/dwm.c +++ b/dwm.c @@ -3526,11 +3526,15 @@ tagmon(const Arg *arg) void togglebar(const Arg *arg) { - #if PERTAG_PATCH && PERTAGBAR_PATCH + #if HOLDBAR_PATCH && PERTAG_PATCH && PERTAGBAR_PATCH + selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = (selmon->showbar == 2 ? 1 : !selmon->showbar); + #elif HOLDBAR_PATCH + selmon->showbar = (selmon->showbar == 2 ? 1 : !selmon->showbar); + #elif PERTAG_PATCH && PERTAGBAR_PATCH selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar; #else selmon->showbar = !selmon->showbar; - #endif // PERTAG_PATCH + #endif // HOLDBAR_PATCH | PERTAG_PATCH updatebarpos(selmon); #if BARPADDING_PATCH XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2*sp, bh); diff --git a/patch/holdbar.c b/patch/holdbar.c index 8ce543b..e3a5bfc 100644 --- a/patch/holdbar.c +++ b/patch/holdbar.c @@ -1,7 +1,9 @@ void holdbar(const Arg *arg) { - selmon->showbar = 1; + if (selmon->showbar) + return; + selmon->showbar = 2; updateholdbarpos(selmon); #if BARPADDING_PATCH XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh); @@ -30,7 +32,7 @@ keyrelease(XEvent *e) return; } } - if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)) { + if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY) && selmon->showbar == 2) { selmon->showbar = 0; updateholdbarpos(selmon); #if BARPADDING_PATCH @@ -94,4 +96,4 @@ updateholdbarpos(Monitor *m) } else m->by = -bh; #endif // EXTRABAR_PATCH -} \ No newline at end of file +}