summaryrefslogtreecommitdiff
path: root/shiftview.c
diff options
context:
space:
mode:
authorbtkoch <brandon@brandon-desktop.localdomain>2023-11-27 13:51:31 -0500
committerbtkoch <brandon@brandon-desktop.localdomain>2023-11-27 13:51:31 -0500
commitb8ed6bb138b28ba3632b51b840b6d1be5e4decec (patch)
tree3c36b5e800ba162369809ad3555acdc2932f961f /shiftview.c
parente81f17d4c196aaed6893fd4beed49991caa3e2a4 (diff)
update
Diffstat (limited to 'shiftview.c')
-rw-r--r--shiftview.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/shiftview.c b/shiftview.c
new file mode 100644
index 0000000..e82053a
--- /dev/null
+++ b/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);
+}