2020-06-05 08:59:36 +00:00
|
|
|
From 7d2a8bf0773ab9d659643ef57b9033062ef207c4 Mon Sep 17 00:00:00 2001
|
2020-05-03 14:00:01 +00:00
|
|
|
From: bakkeby <bakkeby@gmail.com>
|
|
|
|
Date: Sun, 3 May 2020 15:55:08 +0200
|
|
|
|
Subject: [PATCH] This variant of the shiftview patch adds left and right
|
|
|
|
circular shift through tags, but skips tags where there are no clients.
|
|
|
|
|
|
|
|
---
|
|
|
|
config.def.h | 2 ++
|
2020-06-05 08:59:36 +00:00
|
|
|
dwm.c | 31 +++++++++++++++++++++++++++++++
|
|
|
|
2 files changed, 33 insertions(+)
|
2020-05-03 14:00:01 +00:00
|
|
|
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
|
|
index 1c0b587..ad3a5fd 100644
|
|
|
|
--- a/config.def.h
|
|
|
|
+++ b/config.def.h
|
|
|
|
@@ -72,6 +72,8 @@ static Key keys[] = {
|
|
|
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
|
|
|
{ MODKEY, XK_Return, zoom, {0} },
|
|
|
|
{ MODKEY, XK_Tab, view, {0} },
|
|
|
|
+ { MODKEY|ShiftMask, XK_Tab, shiftviewclients, { .i = +1 } },
|
|
|
|
+ { MODKEY|ShiftMask, XK_backslash, shiftviewclients, { .i = -1 } },
|
|
|
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
|
|
|
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
|
|
|
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
|
|
|
diff --git a/dwm.c b/dwm.c
|
2020-06-05 08:59:36 +00:00
|
|
|
index 4465af1..416fc3f 100644
|
2020-05-03 14:00:01 +00:00
|
|
|
--- a/dwm.c
|
|
|
|
+++ b/dwm.c
|
|
|
|
@@ -203,6 +203,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 sigchld(int unused);
|
|
|
|
static void spawn(const Arg *arg);
|
2020-06-05 08:59:36 +00:00
|
|
|
@@ -1610,6 +1611,36 @@ seturgent(Client *c, int urg)
|
2020-05-03 14:00:01 +00:00
|
|
|
XFree(wmh);
|
|
|
|
}
|
|
|
|
|
|
|
|
+void
|
|
|
|
+shiftviewclients(const Arg *arg)
|
|
|
|
+{
|
|
|
|
+ Arg shifted;
|
|
|
|
+ Client *c;
|
|
|
|
+ unsigned int tagmask = 0;
|
|
|
|
+
|
|
|
|
+ for (c = selmon->clients; c; c = c->next)
|
2020-06-05 08:59:36 +00:00
|
|
|
+ #if SCRATCHPADS_PATCH
|
|
|
|
+ if (!(c->tags & SPTAGMASK))
|
|
|
|
+ tagmask = tagmask | c->tags;
|
|
|
|
+ #else
|
2020-05-03 14:00:01 +00:00
|
|
|
+ tagmask = tagmask | c->tags;
|
2020-06-05 08:59:36 +00:00
|
|
|
+ #endif // SCRATCHPADS_PATCH
|
2020-05-03 14:00:01 +00:00
|
|
|
+
|
|
|
|
+ shifted.ui = selmon->tagset[selmon->seltags];
|
|
|
|
+ if (arg->i > 0) // left circular shift
|
|
|
|
+ do {
|
|
|
|
+ shifted.ui = (shifted.ui << arg->i)
|
|
|
|
+ | (shifted.ui >> (LENGTH(tags) - arg->i));
|
|
|
|
+ } while (tagmask && !(shifted.ui & tagmask));
|
|
|
|
+ else // right circular shift
|
|
|
|
+ do {
|
|
|
|
+ shifted.ui = (shifted.ui >> (- arg->i)
|
|
|
|
+ | shifted.ui << (LENGTH(tags) + arg->i));
|
|
|
|
+ } while (tagmask && !(shifted.ui & tagmask));
|
|
|
|
+
|
|
|
|
+ view(&shifted);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void
|
|
|
|
showhide(Client *c)
|
|
|
|
{
|
|
|
|
--
|
|
|
|
2.17.1
|
|
|
|
|