summaryrefslogtreecommitdiff
path: root/patch/shiftview.c
diff options
context:
space:
mode:
Diffstat (limited to 'patch/shiftview.c')
-rw-r--r--patch/shiftview.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/patch/shiftview.c b/patch/shiftview.c
new file mode 100644
index 0000000..423d74b
--- /dev/null
+++ b/patch/shiftview.c
@@ -0,0 +1,19 @@
+void
+shiftview(const Arg *arg)
+{
+ Arg shifted;
+ #if SCRATCHPADS_PATCH
+ unsigned int seltagset = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
+ #else
+ unsigned int seltagset = selmon->tagset[selmon->seltags];
+ #endif // SCRATCHPADS_PATCH
+ if (arg->i > 0) // left circular shift
+ shifted.ui = (seltagset << arg->i)
+ | (seltagset >> (NUMTAGS - arg->i));
+ else // right circular shift
+ shifted.ui = seltagset >> -arg->i
+ | seltagset << (NUMTAGS + arg->i);
+
+ view(&shifted);
+}
+