From cc327e2c66a792886429df1c429fe104ab11eb45 Mon Sep 17 00:00:00 2001 From: pml68 Date: Sat, 10 Feb 2024 12:43:56 +0100 Subject: feat: add shiftviewclients patch, remove unused tagkeys --- dwm/dwm.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'dwm/dwm.c') diff --git a/dwm/dwm.c b/dwm/dwm.c index e4c955d..a8efbb7 100644 --- a/dwm/dwm.c +++ b/dwm/dwm.c @@ -205,6 +205,7 @@ static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); static void seturgent(Client *c, int urg); +static void shiftviewclients(const Arg *arg); static void showhide(Client *c); static void spawn(const Arg *arg); static void tag(const Arg *arg); @@ -1658,6 +1659,46 @@ seturgent(Client *c, int urg) XFree(wmh); } +void +shiftviewclients(const Arg *arg) +{ + Arg shifted; + Client *c; + unsigned int tagmask = 0; + + for (c = selmon->clients; c; c = c->next) + #if SCRATCHPADS_PATCH + if (!(c->tags & SPTAGMASK)) + tagmask = tagmask | c->tags; + #else + tagmask = tagmask | c->tags; + #endif // SCRATCHPADS_PATCH + + #if SCRATCHPADS_PATCH + shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK; + #else + shifted.ui = selmon->tagset[selmon->seltags]; + #endif // SCRATCHPADS_PATCH + if (arg->i > 0) // left circular shift + do { + shifted.ui = (shifted.ui << arg->i) + | (shifted.ui >> (LENGTH(tags) - arg->i)); + #if SCRATCHPADS_PATCH + shifted.ui &= ~SPTAGMASK; + #endif // SCRATCHPADS_PATCH + } while (tagmask && !(shifted.ui & tagmask)); + else // right circular shift + do { + shifted.ui = (shifted.ui >> (- arg->i) + | shifted.ui << (LENGTH(tags) + arg->i)); + #if SCRATCHPADS_PATCH + shifted.ui &= ~SPTAGMASK; + #endif // SCRATCHPADS_PATCH + } while (tagmask && !(shifted.ui & tagmask)); + + view(&shifted); +} + void showhide(Client *c) { -- cgit v1.2.3