[wiki] [sites] [dwm][patch][reorganizetags] add reorganizetags patch || Paul Baldaray
commit ca1e493c376ff086f0a0ffbd1ef78459902bb5d2
Author: Paul Baldaray <paulbaldaray_AT_gmail.com>
Date: Sat Aug 1 06:11:25 2020 -0700
[dwm][patch][reorganizetags] add reorganizetags patch
diff --git a/dwm.suckless.org/patches/reorganizetags/dwm-reorganizetags-6.2.diff b/dwm.suckless.org/patches/reorganizetags/dwm-reorganizetags-6.2.diff
new file mode 100644
index 00000000..23d4e3ab
--- /dev/null
+++ b/dwm.suckless.org/patches/reorganizetags/dwm-reorganizetags-6.2.diff
_AT_@ -0,0 +1,58 @@
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..961a189 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -70,6 +70,7 @@ static Key keys[] = {
+ { MODKEY, XK_d, incnmaster, {.i = -1 } },
+ { MODKEY, XK_h, setmfact, {.f = -0.05} },
+ { MODKEY, XK_l, setmfact, {.f = +0.05} },
++ { MODKEY, XK_r, reorganizetags, {0} },
+ { MODKEY, XK_Return, zoom, {0} },
+ { MODKEY, XK_Tab, view, {0} },
+ { MODKEY|ShiftMask, XK_c, killclient, {0} },
+diff --git a/dwm.c b/dwm.c
+index 4465af1..723d675 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -188,6 +188,7 @@ static void pop(Client *);
+ static void propertynotify(XEvent *e);
+ static void quit(const Arg *arg);
+ static Monitor *recttomon(int x, int y, int w, int h);
++static void reorganizetags(const Arg *arg);
+ static void resize(Client *c, int x, int y, int w, int h, int interact);
+ static void resizeclient(Client *c, int x, int y, int w, int h);
+ static void resizemouse(const Arg *arg);
+_AT_@ -1265,6 +1266,33 @@ recttomon(int x, int y, int w, int h)
+ return r;
+ }
+
++void
++reorganizetags(const Arg *arg) {
++ Client *c;
++ unsigned int occ, unocc, i;
++ unsigned int tagdest[LENGTH(tags)];
++
++ occ = 0;
++ for (c = selmon->clients; c; c = c->next)
++ occ |= (1 << (ffs(c->tags)-1));
++ unocc = 0;
++ for (i = 0; i < LENGTH(tags); ++i) {
++ while (unocc < i && (occ & (1 << unocc)))
++ unocc++;
++ if (occ & (1 << i)) {
++ tagdest[i] = unocc;
++ occ &= ~(1 << i);
++ occ |= 1 << unocc;
++ }
++ }
++
++ for (c = selmon->clients; c; c = c->next)
++ c->tags = 1 << tagdest[ffs(c->tags)-1];
++ if (selmon->sel)
++ selmon->tagset[selmon->seltags] = selmon->sel->tags;
++ arrange(selmon);
++}
++
+ void
+ resize(Client *c, int x, int y, int w, int h, int interact)
+ {
diff --git a/dwm.suckless.org/patches/reorganizetags/index.md b/dwm.suckless.org/patches/reorganizetags/index.md
new file mode 100644
index 00000000..c42e36e6
--- /dev/null
+++ b/dwm.suckless.org/patches/reorganizetags/index.md
_AT_@ -0,0 +1,22 @@
+reorganizetags
+==============
+
+Description
+-----------
+
+Shifts all clients per tag to leftmost unoccupied tags.
+
+For example, if clients A, B, C are tagged on tags 1, 5, 9 respectively, when
+this function is called, they will now be on 1, 2, and 3. The focused client
+will also remain focused.
+
+Clients on multiple tags will be treated as if they only were only on their
+leftmost tag, and will be reduced to one tag after the operation is complete.
+
+Download
+--------
+* [dwm-reorganizetags-6.2.diff](dwm-reorganizetags-6.2.diff)
+
+Authors
+-------
+* Paul Baldaray - <paulbaldaray_AT_gmail.com>
Received on Sat Aug 01 2020 - 15:14:13 CEST
This archive was generated by hypermail 2.3.0
: Sat Aug 01 2020 - 15:24:43 CEST