summaryrefslogtreecommitdiffhomepage
path: root/patch/shiftboth.c
diff options
context:
space:
mode:
Diffstat (limited to 'patch/shiftboth.c')
-rw-r--r--patch/shiftboth.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/patch/shiftboth.c b/patch/shiftboth.c
new file mode 100644
index 0000000..5c7c916
--- /dev/null
+++ b/patch/shiftboth.c
@@ -0,0 +1,21 @@
+void
+shiftboth(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);
+ view(&shifted);
+}