aboutsummaryrefslogtreecommitdiff
path: root/dwm/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm/dwm.c')
-rw-r--r--dwm/dwm.c41
1 files changed, 41 insertions, 0 deletions
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);
@@ -1659,6 +1660,46 @@ seturgent(Client *c, int urg)
}
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)
{
if (!c)