-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathdwm-shiftviewclients-6.2.diff
87 lines (83 loc) · 2.68 KB
/
dwm-shiftviewclients-6.2.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From 72fbed3ecf268f09861e65d0255150597db715bb Mon Sep 17 00:00:00 2001
From: Bakkeby <[email protected]>
Date: Thu, 27 Jun 2024 08:24:23 +0200
Subject: [PATCH] shiftview 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 ++
dwm.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
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
index 4465af1..55d5035 100644
--- 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);
@@ -1610,6 +1611,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)
{
--
2.45.2