summaryrefslogtreecommitdiff
path: root/patches/shiftview.c
diff options
context:
space:
mode:
Diffstat (limited to 'patches/shiftview.c')
-rw-r--r--patches/shiftview.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/patches/shiftview.c b/patches/shiftview.c
new file mode 100644
index 0000000..e82053a
--- /dev/null
+++ b/patches/shiftview.c
@@ -0,0 +1,19 @@
+/** Function to shift the current view to the left/right
+ *
+ * @param: "arg->i" stores the number of tags to shift right (positive value)
+ * or left (negative value)
+ */
+void
+shiftview(const Arg *arg) {
+ Arg shifted;
+
+ if(arg->i > 0) // left circular shift
+ shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
+ | (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
+
+ else // right circular shift
+ shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
+ | selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
+
+ view(&shifted);
+}