summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-02-11 08:27:00 +0100
committerbakkeby <[email protected]>2020-02-11 11:27:39 +0100
commit90a848d608cb9370c8a03980edda587c463451c5 (patch)
tree5b1d88311cfa0cbc4093e009e5ac1d3774dd69bb /patch
parent8cb609fa1ed1ead8afce4b6003bdd59c9e17226b (diff)
downloaddwm-flexipatch-90a848d608cb9370c8a03980edda587c463451c5.tar.gz
dwm-flexipatch-90a848d608cb9370c8a03980edda587c463451c5.zip
Adding swaptags patch
Diffstat (limited to 'patch')
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/swaptags.c22
-rw-r--r--patch/swaptags.h1
4 files changed, 29 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c
index ef71088..4ed46cd 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -113,6 +113,9 @@
#if SWAPFOCUS_PATCH && PERTAG_PATCH
#include "swapfocus.c"
#endif
+#if SWAPTAGS_PATCH
+#include "swaptags.c"
+#endif
#if SWITCHCOL_PATCH
#include "switchcol.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 62ecd46..ba906a5 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -113,6 +113,9 @@
#if SWAPFOCUS_PATCH && PERTAG_PATCH
#include "swapfocus.h"
#endif
+#if SWAPTAGS_PATCH
+#include "swaptags.h"
+#endif
#if SWITCHCOL_PATCH
#include "switchcol.h"
#endif
diff --git a/patch/swaptags.c b/patch/swaptags.c
new file mode 100644
index 0000000..c43a83f
--- /dev/null
+++ b/patch/swaptags.c
@@ -0,0 +1,22 @@
+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);
+} \ No newline at end of file
diff --git a/patch/swaptags.h b/patch/swaptags.h
new file mode 100644
index 0000000..150fcce
--- /dev/null
+++ b/patch/swaptags.h
@@ -0,0 +1 @@
+static void swaptags(const Arg *arg); \ No newline at end of file