From 01231194cc7c8a4f3ac31e2fc5d72cb0c65e68b4 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 3 May 2020 16:08:23 -0400 Subject: super+shift+g/; to send to prev/next window i'll merge the functions later maybe lol --- shiftview.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'shiftview.c') 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); + } +} -- cgit v1.2.3