[wiki] [sites] [dwm][patch] add togglebartag patch || Jan Gil
commit d73e4a6a5753132e73e8174481f7f5d3948961ce
Author: Jan Gil <jangildev_AT_protonmail.com>
Date: Sat Apr 22 07:33:23 2023 +0200
[dwm][patch] add togglebartag patch
diff --git a/dwm.suckless.org/patches/togglebartag/index.md b/dwm.suckless.org/patches/togglebartag/index.md
new file mode 100644
index 00000000..03483ca3
--- /dev/null
+++ b/dwm.suckless.org/patches/togglebartag/index.md
_AT_@ -0,0 +1,14 @@
+togglebartag
+============
+
+Description
+-----------
+This patch allows you to toggle bar for each tag separately.
+
+Download
+--------
+* [togglebartag-20230421-e81f17d.diff](togglebartag-20230421-e81f17d.diff)
+
+Authors
+-------
+* Jan Gil <jangildev_AT_protonmail.com>
diff --git a/dwm.suckless.org/patches/togglebartag/togglebartag-20230421-e81f17d.diff b/dwm.suckless.org/patches/togglebartag/togglebartag-20230421-e81f17d.diff
new file mode 100644
index 00000000..378df031
--- /dev/null
+++ b/dwm.suckless.org/patches/togglebartag/togglebartag-20230421-e81f17d.diff
_AT_@ -0,0 +1,76 @@
+diff --git a/config.def.h b/config.def.h
+index 9efa774..6e005df 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -65,6 +65,7 @@ static const Key keys[] = {
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_b, togglebar, {0} },
++ { MODKEY|ShiftMask, XK_b, togglebar, {.i = 1} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+diff --git a/dwm.c b/dwm.c
+index f1d86b2..2da996f 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -123,6 +123,7 @@ struct Monitor {
+ unsigned int sellt;
+ unsigned int tagset[2];
+ int showbar;
++ unsigned int barmask;
+ int topbar;
+ Client *clients;
+ Client *sel;
+_AT_@ -640,6 +641,7 @@ createmon(void)
+ m->mfact = mfact;
+ m->nmaster = nmaster;
+ m->showbar = showbar;
++ m->barmask = showbar * TAGMASK;
+ m->topbar = topbar;
+ m->lt[0] = &layouts[0];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+_AT_@ -704,7 +706,7 @@ drawbar(Monitor *m)
+ unsigned int i, occ = 0, urg = 0;
+ Client *c;
+
+- if (!m->showbar)
++ if (!(m->tagset[m->seltags] & m->barmask))
+ return;
+
+ /* draw status first so it can be overdrawn by tags later */
+_AT_@ -1715,7 +1717,16 @@ tile(Monitor *m)
+ void
+ togglebar(const Arg *arg)
+ {
+- selmon->showbar = !selmon->showbar;
++ unsigned int ctag = selmon->tagset[selmon->seltags];
++
++ if(arg->i == 1 || ctag == TAGMASK){
++ selmon->showbar = !selmon->showbar;
++ selmon->barmask = selmon->showbar * TAGMASK;
++ }
++ else {
++ selmon->barmask ^= ctag;
++ }
+ updatebarpos(selmon);
+ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
+ arrange(selmon);
+_AT_@ -1842,7 +1853,7 @@ updatebarpos(Monitor *m)
+ {
+ m->wy = m->my;
+ m->wh = m->mh;
+- if (m->showbar) {
++ if ((m->tagset[m->seltags] & m->barmask)) {
+ m->wh -= bh;
+ m->by = m->topbar ? m->wy : m->wy + m->wh;
+ m->wy = m->topbar ? m->wy + bh : m->wy;
+_AT_@ -2058,6 +2069,10 @@ view(const Arg *arg)
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ if (arg->ui & TAGMASK)
+ selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
++ updatebarpos(selmon);
++ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
+ focus(NULL);
+ arrange(selmon);
+ }
Received on Sat Apr 22 2023 - 07:33:39 CEST
This archive was generated by hypermail 2.3.0
: Sat Apr 22 2023 - 07:36:52 CEST