aboutsummaryrefslogtreecommitdiffstats
path: root/applied/dwm-switchtotag-6.2.diff
blob: 453f8ef63ddf5c5254c5b6a08bd788226bc2c55a (plain)
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
diff -up dwm-6.2-original/config.def.h dwm-6.2-modified/config.def.h
--- dwm-6.2-original/config.def.h	2019-02-02 14:55:28.000000000 +0200
+++ dwm-6.2-modified/config.def.h	2019-11-18 19:36:22.515566509 +0200
@@ -26,9 +26,9 @@ static const Rule rules[] = {
 	 *	WM_CLASS(STRING) = instance, class
 	 *	WM_NAME(STRING) = title
 	 */
-	/* class      instance    title       tags mask     isfloating   monitor */
-	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
-	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
+	/* class      instance    title       tags mask     switchtotag    isfloating   monitor */
+	{ "Gimp",     NULL,       NULL,       0,            0,             1,           -1 },
+	{ "Firefox",  NULL,       NULL,       1 << 8,       0,             0,           -1 },
 };
 
 /* layout(s) */
diff -up dwm-6.2-original/dwm.c dwm-6.2-modified/dwm.c
--- dwm-6.2-original/dwm.c	2019-02-02 14:55:28.000000000 +0200
+++ dwm-6.2-modified/dwm.c	2019-11-18 19:37:18.792187705 +0200
@@ -92,6 +92,7 @@ struct Client {
 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 	int bw, oldbw;
 	unsigned int tags;
+	unsigned int switchtotag;
 	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 	Client *next;
 	Client *snext;
@@ -137,6 +138,7 @@ typedef struct {
 	const char *instance;
 	const char *title;
 	unsigned int tags;
+	unsigned int switchtotag;
 	int isfloating;
 	int monitor;
 } Rule;
@@ -302,6 +304,11 @@ applyrules(Client *c)
 			for (m = mons; m && m->num != r->monitor; m = m->next);
 			if (m)
 				c->mon = m;
+			if (r->switchtotag) {
+				Arg a = { .ui = r->tags };
+				c->switchtotag = selmon->tagset[selmon->seltags];
+				view(&a);
+			}
 		}
 	}
 	if (ch.res_class)
@@ -1782,6 +1789,10 @@ unmanage(Client *c, int destroyed)
 	focus(NULL);
 	updateclientlist();
 	arrange(m);
+	if (c->switchtotag) {
+		Arg a = { .ui = c->switchtotag };
+		view(&a);
+	}
 }
 
 void