commit 81ddb3cec690e861174a339ab01f9d2715a6ea78
parent fb9554855ff7e8feea73f0fe68c8a508e34f2089
Author: Elliott Seymour <rensenware@proton.me>
Date: Thu, 28 Jul 2022 15:00:55 -0400
[dwm] [patch] [tagshift] add patch to circularly shift viewed tags or client tags back and forth
Diffstat:
2 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/tagshift/dwm-tagshift-6.3.diff b/dwm.suckless.org/patches/tagshift/dwm-tagshift-6.3.diff
@@ -0,0 +1,69 @@
+diff --git a/config.def.h b/config.def.h
+index a2ac963..1bbede2 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -69,6 +69,10 @@ static Key keys[] = {
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+ { MODKEY, XK_d, incnmaster, {.i = -1 } },
++ { MODKEY, XK_Left, shiftview, {.i = -1 } },
++ { MODKEY, XK_Right, shiftview, {.i = +1 } },
++ { MODKEY|ShiftMask, XK_Left, shifttag, {.i = -1 } },
++ { MODKEY|ShiftMask, XK_Right, shifttag, {.i = +1 } },
+ { MODKEY, XK_h, setmfact, {.f = -0.05} },
+ { MODKEY, XK_l, setmfact, {.f = +0.05} },
+ { MODKEY, XK_Return, zoom, {0} },
+diff --git a/dwm.c b/dwm.c
+index a96f33c..4bf0f70 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -204,6 +204,8 @@ static void setlayout(const Arg *arg);
+ static void setmfact(const Arg *arg);
+ static void setup(void);
+ static void seturgent(Client *c, int urg);
++static void shiftview(const Arg *arg);
++static void shifttag(const Arg *arg);
+ static void showhide(Client *c);
+ static void sigchld(int unused);
+ static void spawn(const Arg *arg);
+@@ -1632,6 +1634,40 @@ showhide(Client *c)
+ }
+ }
+
++void
++shiftview(const Arg *arg) {
++ Arg shifted;
++
++ if(arg->i > 0) /* left circular shift */
++ shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
++ | (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
++
++ else /* right circular shift */
++ shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
++ | selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
++
++ view(&shifted);
++}
++
++void
++shifttag(const Arg *arg) {
++ Arg shifted;
++ Client *c;
++
++ if (!selmon->sel)
++ return;
++ c = selmon->sel;
++
++ if (arg->i > 0) /* left circular shift */
++ shifted.ui = (c->tags ^ (c->tags << arg->i))
++ ^ (c->tags >> (LENGTH(tags) - arg->i));
++ else /* right circular shift */
++ shifted.ui = (c->tags ^ (c->tags >> (-arg->i)))
++ ^ (c->tags << (LENGTH(tags) + arg->i));
++
++ toggletag(&shifted);
++}
++
+ void
+ sigchld(int unused)
+ {
diff --git a/dwm.suckless.org/patches/tagshift/index.md b/dwm.suckless.org/patches/tagshift/index.md
@@ -0,0 +1,14 @@
+Tagshift
+========
+Adds keybinds for circularly shifting back and forth viewed tags or a client's tags. This is an alternative to the [adjacenttag patch](https://dwm.suckless.org/patches/adjacenttag/) that allows for shifting forward and back all viewed tags, rather than just one. This is by default bound to mod + left and mod + right for shifting the viewed tags, mod + shift + left and mod + shift + right for shifting a client's tags.
+
+For example, shifting the tags 2 and 3 to the right by one would change them to 3 and 4, and if a client's tags were set to 1 and 9, shifting them to the left by one would change them to 8 and 9.
+
+Download
+--------
+* [dwm-tagshift-6.3.diff](dwm-tagshift-6.3.diff)
+
+Authors
+-------
+* Fernando C.V. <ferkiwi@gmail.com>
+* Elliott Seymour <rensenware@proton.me>