summaryrefslogtreecommitdiffhomepage
path: root/patch/shiftboth.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2022-07-04 13:34:41 +0200
committerbakkeby <[email protected]>2022-07-04 13:45:06 +0200
commitd3ab291944016be14002875ef8f4a318bd672c50 (patch)
treeba7b2c45670638885bee95a594e66ddbf1e45660 /patch/shiftboth.c
parent279c571986a8c9b22acf4fe462e3d1470bf2925e (diff)
downloaddwm-flexipatch-d3ab291944016be14002875ef8f4a318bd672c50.tar.gz
dwm-flexipatch-d3ab291944016be14002875ef8f4a318bd672c50.zip
Adding shiftboth patch ref. #270
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);
+}