summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch')
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/shiftswaptags.c20
-rw-r--r--patch/shiftswaptags.h1
-rw-r--r--patch/swaptags.c1
5 files changed, 27 insertions, 1 deletions
diff --git a/patch/include.c b/patch/include.c
index a4130da..5318ea2 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -235,6 +235,9 @@
#if SHIFTBOTH_PATCH
#include "shiftboth.c"
#endif
+#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
+#include "shiftswaptags.c"
+#endif
#if SHIFTTAG_PATCH
#include "shifttag.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 095bd70..6803c5d 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -237,6 +237,9 @@
#if SHIFTBOTH_PATCH
#include "shiftboth.h"
#endif
+#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
+#include "shiftswaptags.h"
+#endif
#if SHIFTTAG_PATCH
#include "shifttag.h"
#endif
diff --git a/patch/shiftswaptags.c b/patch/shiftswaptags.c
new file mode 100644
index 0000000..d9f797a
--- /dev/null
+++ b/patch/shiftswaptags.c
@@ -0,0 +1,20 @@
+/* swaps "tags" (all the clients) with the next/prev tag. */
+void
+shiftswaptags(const Arg *arg)
+{
+ Arg shifted;
+ #if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
+ shifted.ui = selmon->tagset[selmon->seltags];
+ #else
+ shifted.ui = selmon->tagset[selmon->seltags];
+ #endif // SCRATCHPADS_PATCH
+
+ if (arg->i > 0) /* left circular shift */
+ shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (NUMTAGS - arg->i)));
+ else /* right circular shift */
+ shifted.ui = ((shifted.ui >> -arg->i) | (shifted.ui << (NUMTAGS + arg->i)));
+ #if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
+ shifted.ui &= ~SPTAGMASK;
+ #endif // SCRATCHPADS_PATCH
+ swaptags(&shifted);
+}
diff --git a/patch/shiftswaptags.h b/patch/shiftswaptags.h
new file mode 100644
index 0000000..1977e36
--- /dev/null
+++ b/patch/shiftswaptags.h
@@ -0,0 +1 @@
+static void shiftswaptags(const Arg *arg);
diff --git a/patch/swaptags.c b/patch/swaptags.c
index 7e1e920..d2341ef 100644
--- a/patch/swaptags.c
+++ b/patch/swaptags.c
@@ -28,4 +28,3 @@ swaptags(const Arg *arg)
view(&((Arg) { .ui = newtag }));
}
-