This repository has been archived by the owner on Jan 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
dwm-6.0-cycle.diff
70 lines (67 loc) · 1.63 KB
/
dwm-6.0-cycle.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
--- dwm.c 2013-03-19 01:10:27.509901099 +0100
+++ dwm.c 2013-03-19 01:18:53.909892580 +0100
@@ -183,6 +183,7 @@
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void cycle(const Arg *arg);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -237,10 +238,12 @@
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
+static int shifttag(int dist);
static void showhide(Client *c);
static void sigchld(int unused);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
+static void tagcycle(const Arg *arg);
static void tagmon(const Arg *arg);
static int textnw(const char *text, unsigned int len);
static void tile(Monitor *);
@@ -774,6 +777,13 @@
}
void
+cycle(const Arg *arg) {
+ const Arg a = { .i = shifttag(arg->i) };
+
+ view(&a);
+}
+
+void
destroynotify(XEvent *e) {
Client *c;
XDestroyWindowEvent *ev = &e->xdestroywindow;
@@ -1815,6 +1825,17 @@
grabkeys();
}
+int
+shifttag(int dist) {
+ int seltags = selmon->tagset[selmon->seltags] & TAGMASK;
+
+ if(dist > 0) /* left circular shift */
+ seltags = (seltags << dist) | (seltags >> (LENGTH(tags) - dist));
+ else /* right circular shift */
+ seltags = (seltags >> (- dist)) | (seltags << (LENGTH(tags) + dist));
+ return seltags;
+}
+
void
showhide(Client *c) {
if(!c)
@@ -1861,6 +1882,14 @@
}
void
+tagcycle(const Arg *arg) {
+ const Arg a = { .i = shifttag(arg->i) };
+
+ tag(&a);
+ view(&a);
+}
+
+void
tagmon(const Arg *arg) {
if(!selmon->sel || !mons->next)
return;