aboutsummaryrefslogtreecommitdiffstats
path: root/patches/dwm-swaptags-6.2.diff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/dwm-swaptags-6.2.diff')
-rw-r--r--patches/dwm-swaptags-6.2.diff68
1 files changed, 68 insertions, 0 deletions
diff --git a/patches/dwm-swaptags-6.2.diff b/patches/dwm-swaptags-6.2.diff
new file mode 100644
index 0000000..e9d51c9
--- /dev/null
+++ b/patches/dwm-swaptags-6.2.diff
@@ -0,0 +1,68 @@
+From 9513cc776dc8114967988d4abc32fd7f37446ddb Mon Sep 17 00:00:00 2001
+From: fossy <fossy@dnmx.org>
+Date: Sun, 28 Nov 2021 21:34:37 +0100
+Subject: [PATCH] Move function and it's prototype from config.def.h to dwm.c
+
+---
+ config.def.h | 3 ++-
+ dwm.c | 23 +++++++++++++++++++++++
+ 2 files changed, 25 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index a2ac963..f31a66d 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -50,7 +50,8 @@ static const Layout layouts[] = {
+ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
+ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
+- { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
++ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
++ { Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
+
+ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
+ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+diff --git a/dwm.c b/dwm.c
+index 5e4d494..d11addd 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -234,6 +234,7 @@ static int xerror(Display *dpy, XErrorEvent *ee);
+ static int xerrordummy(Display *dpy, XErrorEvent *ee);
+ static int xerrorstart(Display *dpy, XErrorEvent *ee);
+ static void zoom(const Arg *arg);
++static void swaptags(const Arg *arg);
+
+ /* variables */
+ static const char broken[] = "broken";
+@@ -2127,6 +2128,28 @@ zoom(const Arg *arg)
+ pop(c);
+ }
+
++void
++swaptags(const Arg *arg)
++{
++ unsigned int newtag = arg->ui & TAGMASK;
++ unsigned int curtag = selmon->tagset[selmon->seltags];
++
++ if (newtag == curtag || !curtag || (curtag & (curtag-1)))
++ return;
++
++ for (Client *c = selmon->clients; c != NULL; c = c->next) {
++ if((c->tags & newtag) || (c->tags & curtag))
++ c->tags ^= curtag ^ newtag;
++
++ if(!c->tags) c->tags = newtag;
++ }
++
++ selmon->tagset[selmon->seltags] = newtag;
++
++ focus(NULL);
++ arrange(selmon);
++}
++
+ int
+ main(int argc, char *argv[])
+ {
+--
+2.34.1
+