summaryrefslogtreecommitdiff
path: root/shiftview.c
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-05-03 16:08:23 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-05-03 16:08:23 -0400
commit01231194cc7c8a4f3ac31e2fc5d72cb0c65e68b4 (patch)
tree27372a1344e620e935c04619a068a7a3152cb241 /shiftview.c
parent8cd6c7f0ea1834c14086eb3cb068c11406d4c3a2 (diff)
super+shift+g/; to send to prev/next window
i'll merge the functions later maybe lol
Diffstat (limited to 'shiftview.c')
-rw-r--r--shiftview.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/shiftview.c b/shiftview.c
index b592a67..a52ccd7 100644
--- a/shiftview.c
+++ b/shiftview.c
@@ -34,3 +34,35 @@ shiftview(const Arg *arg)
view(&a);
}
}
+
+void
+shifttag(const Arg *arg)
+{
+ Arg a;
+ Client *c;
+ unsigned visible = 0;
+ int i = arg->i;
+ int count = 0;
+ int nextseltags, curseltags = selmon->tagset[selmon->seltags];
+
+ do {
+ if(i > 0) // left circular shift
+ nextseltags = (curseltags << i) | (curseltags >> (LENGTH(tags) - i));
+
+ else // right circular shift
+ nextseltags = curseltags >> (- i) | (curseltags << (LENGTH(tags) + i));
+
+ // Check if tag is visible
+ for (c = selmon->clients; c && !visible; c = c->next)
+ if (nextseltags & c->tags) {
+ visible = 1;
+ break;
+ }
+ i += arg->i;
+ } while (!visible && ++count < 10);
+
+ if (count < 10) {
+ a.i = nextseltags;
+ tag(&a);
+ }
+}