summaryrefslogtreecommitdiff
path: root/dwl/dwl-patches/patches/tagshift
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwl/dwl-patches/patches/tagshift
Diffstat (limited to 'dwl/dwl-patches/patches/tagshift')
-rwxr-xr-xdwl/dwl-patches/patches/tagshift/README.md10
-rwxr-xr-xdwl/dwl-patches/patches/tagshift/tagshift.patch83
2 files changed, 93 insertions, 0 deletions
diff --git a/dwl/dwl-patches/patches/tagshift/README.md b/dwl/dwl-patches/patches/tagshift/README.md
new file mode 100755
index 0000000..e3d7a03
--- /dev/null
+++ b/dwl/dwl-patches/patches/tagshift/README.md
@@ -0,0 +1,10 @@
+### Description
+Port of the [tagshift](https://dwm.suckless.org/patches/tagshift/) patch into dwl.
+
+Allows a user to change his view and/or focused client into the next or previous tag.
+
+### Download
+- [0.7](/dwl/dwl-patches/raw/branch/main/patches/tagshift/tagshift.patch)
+### Authors
+- [h3nc4](https://codeberg.org/h3nc4)
+ me@h3nc4.com
diff --git a/dwl/dwl-patches/patches/tagshift/tagshift.patch b/dwl/dwl-patches/patches/tagshift/tagshift.patch
new file mode 100755
index 0000000..fac6033
--- /dev/null
+++ b/dwl/dwl-patches/patches/tagshift/tagshift.patch
@@ -0,0 +1,83 @@
+From 938c63ad0a8a706fba0b4db1c66397e9defdcb92 Mon Sep 17 00:00:00 2001
+From: h3nc4 <me@h3nc4.com>
+Date: Mon, 17 Mar 2025 17:38:22 -0300
+Subject: [PATCH] port the tagshift patch from dwm
+
+---
+ config.def.h | 4 ++++
+ dwl.c | 37 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 41 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 22d2171..72dbaa1 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -131,6 +131,10 @@ static const Key keys[] = {
+ { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
+ { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
+ { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
++ { MODKEY, XKB_KEY_Left, shiftview, {.i = -1 } },
++ { MODKEY, XKB_KEY_Right, shiftview, {.i = +1 } },
++ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, shifttag, {.i = -1 } },
++ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, shifttag, {.i = +1 } },
+ { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
+ { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
+ { MODKEY, XKB_KEY_Return, zoom, {0} },
+diff --git a/dwl.c b/dwl.c
+index cf3ef70..be1e89e 100644
+--- a/dwl.c
++++ b/dwl.c
+@@ -333,6 +333,8 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
+ static void setpsel(struct wl_listener *listener, void *data);
+ static void setsel(struct wl_listener *listener, void *data);
+ static void setup(void);
++static void shiftview(const Arg *arg);
++static void shifttag(const Arg *arg);
+ static void spawn(const Arg *arg);
+ static void startdrag(struct wl_listener *listener, void *data);
+ static void tag(const Arg *arg);
+@@ -2646,6 +2648,41 @@ setup(void)
+ #endif
+ }
+
++void
++shiftview(const Arg *arg)
++{
++ Arg a;
++ int nextseltags, curseltags = selmon->tagset[selmon->seltags];
++ if (arg->i > 0) // left circular shift
++ nextseltags = (curseltags << arg->i) | (curseltags >> (TAGCOUNT - arg->i));
++ else // right circular shift
++ nextseltags = curseltags >> (-arg->i) | (curseltags << (TAGCOUNT + arg->i));
++
++ a.i = nextseltags; // Change view to the new tag
++ view(&a);
++}
++
++void
++shifttag(const Arg *arg)
++{
++ Arg a;
++ int nextseltags, curseltags = selmon->tagset[selmon->seltags];
++ Client *sel = focustop(selmon);
++ if (!sel)
++ return;
++ if (arg->i > 0) // left circular shift
++ nextseltags = (curseltags << arg->i) | (curseltags >> (TAGCOUNT - arg->i));
++ else // right circular shift
++ nextseltags = curseltags >> (-arg->i) | (curseltags << (TAGCOUNT + arg->i));
++
++ sel->tags = nextseltags & TAGMASK;// Apply new tag to the client
++ a.i = nextseltags; // Change view to the new tag
++ view(&a);
++
++ arrange(selmon);
++ printstatus(); // change to 'drawbars();' if using "bars" patch
++}
++
+ void
+ spawn(const Arg *arg)
+ {
+--
+2.47.2
+