about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--client.c5
-rw-r--r--dwm.h2
-rw-r--r--event.c13
-rw-r--r--main.c1
4 files changed, 20 insertions, 1 deletions
diff --git a/client.c b/client.c
index f92df83..9b91ab6 100644
--- a/client.c
+++ b/client.c
@@ -58,6 +58,8 @@ focus(Client *c)
 	drawtitle(c);
 	XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
 	XSync(dpy, False);
+	XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32,
+			PropModeReplace, (unsigned char *)&c->win, 1);
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }
 
@@ -459,6 +461,9 @@ unmanage(Client *c)
 	arrange(NULL);
 	if(sel)
 		focus(sel);
+	else
+		XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32,
+				PropModeReplace, (unsigned char *)NULL, 1);
 }
 
 void
diff --git a/dwm.h b/dwm.h
index 57d628a..efef213 100644
--- a/dwm.h
+++ b/dwm.h
@@ -22,7 +22,7 @@ union Arg {
 };
 
 /* atoms */
-enum { NetSupported, NetWMName, NetLast };
+enum { NetSupported, NetWMName, NetActiveWindow, NetLast };
 enum { WMProtocols, WMDelete, WMLast };
 
 /* cursor */
diff --git a/event.c b/event.c
index 2e4f62e..c3169aa 100644
--- a/event.c
+++ b/event.c
@@ -146,6 +146,18 @@ buttonpress(XEvent *e)
 }
 
 static void
+clientmessage(XEvent *e)
+{
+	Client *c;
+	XClientMessageEvent *ev = &e->xclient;
+
+	if(ev->message_type == netatom[NetActiveWindow]) {
+		if((c = getclient(ev->window)) && c->tags[tsel])
+			focus(c);
+	}
+}
+
+static void
 configurerequest(XEvent *e)
 {
 	Client *c;
@@ -339,6 +351,7 @@ unmapnotify(XEvent *e)
 
 void (*handler[LASTEvent]) (XEvent *) = {
 	[ButtonPress] = buttonpress,
+	[ClientMessage] = clientmessage,
 	[ConfigureRequest] = configurerequest,
 	[DestroyNotify] = destroynotify,
 	[EnterNotify] = enternotify,
diff --git a/main.c b/main.c
index 5efe599..ded4761 100644
--- a/main.c
+++ b/main.c
@@ -201,6 +201,7 @@ main(int argc, char *argv[])
 	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
 	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
 	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
+	netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
 	XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
 			PropModeReplace, (unsigned char *) netatom, NetLast);
 
6 +0000 committer James Booth <boothj5@gmail.com> 2013-01-12 23:10:56 +0000 Added jid datatype' href='/danisanti/profani-tty/commit/tests/test_jid.c?id=94bcf1889d5a07305784ff5bc92afffa71a5ccd3'>94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
3a22719b ^
8bdab23e ^
3a22719b ^
07308673 ^
3a22719b ^

07308673 ^
3a22719b ^
8bdab23e ^
3a22719b ^
07308673 ^
3a22719b ^

07308673 ^
d239a127 ^


07308673 ^




d239a127 ^

07308673 ^
d239a127 ^


07308673 ^




d239a127 ^

07308673 ^
d239a127 ^


07308673 ^




d239a127 ^

07308673 ^
d239a127 ^


07308673 ^




94bcf188 ^
e263e00a ^

















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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185