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
|
From eb9b7e135d71bf3c534fa1143037c58cb5553c55 Mon Sep 17 00:00:00 2001
From: Andrew <saintruler@gmail.com>
Date: Fri, 5 Jun 2020 13:48:02 +0400
Subject: [PATCH] Added function scrollview
---
config.def.h | 2 ++
dwm.c | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/config.def.h b/config.def.h
index 3f7da51..4df636f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -103,6 +103,8 @@ static Key keys[] = {
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
+ { MODKEY, XK_Left, scrollview, {.i = -1 } },
+ { MODKEY, XK_Right, scrollview, {.i = +1 } },
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};
diff --git a/dwm.c b/dwm.c
index 6e54eff..97cf3c5 100644
--- a/dwm.c
+++ b/dwm.c
@@ -262,6 +262,7 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void scrollview(const Arg *arg);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static Client *wintosystrayicon(Window w);
@@ -2408,6 +2409,24 @@ view(const Arg *arg)
arrange(selmon);
}
+void
+scrollview(const Arg *arg)
+{
+ int ui = 0;
+ if (arg->i < 0)
+ ui = selmon->tagset[selmon->seltags] >> 1;
+ else if (arg->i > 0)
+ ui = selmon->tagset[selmon->seltags] << 1;
+
+ if ((ui & TAGMASK) == 0 || (ui & TAGMASK) == selmon->tagset[selmon->seltags])
+ return;
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ if (ui & TAGMASK)
+ selmon->tagset[selmon->seltags] = ui;
+ focus(NULL);
+ arrange(selmon);
+}
+
Client *
wintoclient(Window w)
{
--
2.27.0
|