summaryrefslogtreecommitdiffhomepage
path: root/patch/shifttag.c
diff options
context:
space:
mode:
Diffstat (limited to 'patch/shifttag.c')
-rw-r--r--patch/shifttag.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/patch/shifttag.c b/patch/shifttag.c
new file mode 100644
index 0000000..97365f1
--- /dev/null
+++ b/patch/shifttag.c
@@ -0,0 +1,20 @@
+/* Sends a window to the next/prev tag */
+void
+shifttag(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
+ tag(&shifted);
+}