aboutsummaryrefslogtreecommitdiff
path: root/dwm/dwm.c
diff options
context:
space:
mode:
authorpml68 <pml31@protonmail.com>2024-02-10 12:43:56 +0100
committerpml68 <pml31@protonmail.com>2024-02-10 12:43:56 +0100
commitcc327e2c66a792886429df1c429fe104ab11eb45 (patch)
tree2fb45b3d1f7b27c78fc8af47fa031a87b86f00f6 /dwm/dwm.c
parentfeat: add .bashrc (diff)
downloadsuckless-setup-cc327e2c66a792886429df1c429fe104ab11eb45.tar.gz
feat: add shiftviewclients patch, remove unused tagkeys
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)