dwm-focusonnetactive-2017-12-24-3756f7f.diff - sites - public wiki contents of … | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-focusonnetactive-2017-12-24-3756f7f.diff (1702B) | |
--- | |
1 From cda7fd4e732c6db03180301e45b48b961fda5eba Mon Sep 17 00:00:00 2001 | |
2 From: Danny O'Brien <[email protected]> | |
3 Date: Sat, 23 Dec 2017 16:45:29 -0800 | |
4 Subject: [PATCH] Activate a window in response to _NET_ACTIVE_WINDOW | |
5 | |
6 By default, dwm response to client requests to _NET_ACTIVE_WINDOW client | |
7 messages by setting the urgency bit on the named window. | |
8 | |
9 This patch activates the window instead. | |
10 | |
11 Both behaviours are legitimate according to | |
12 https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm14… | |
13 | |
14 One should decide which of these one should perform based on the message | |
15 senders' untestable claims that it represents the end-user. Setting the | |
16 urgency bit is the conservative decision. This patch implements the more | |
17 trusting alternative. | |
18 | |
19 It also allows dwm to work with `wmctrl -a` and other external window | |
20 management utilities. | |
21 --- | |
22 dwm.c | 10 ++++++++-- | |
23 1 file changed, 8 insertions(+), 2 deletions(-) | |
24 | |
25 diff --git a/dwm.c b/dwm.c | |
26 index ff893df..b278182 100644 | |
27 --- a/dwm.c | |
28 +++ b/dwm.c | |
29 @@ -515,6 +515,7 @@ clientmessage(XEvent *e) | |
30 { | |
31 XClientMessageEvent *cme = &e->xclient; | |
32 Client *c = wintoclient(cme->window); | |
33 + unsigned int i; | |
34 | |
35 if (!c) | |
36 return; | |
37 @@ -524,8 +525,13 @@ clientmessage(XEvent *e) | |
38 setfullscreen(c, (cme->data.l[0] == 1 /* _NET_W… | |
39 || (cme->data.l[0] == 2 /* _NET_WM_STAT… | |
40 } else if (cme->message_type == netatom[NetActiveWindow]) { | |
41 - if (c != selmon->sel && !c->isurgent) | |
42 - seturgent(c, 1); | |
43 + for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); … | |
44 + if (i < LENGTH(tags)) { | |
45 + const Arg a = {.ui = 1 << i}; | |
46 + view(&a); | |
47 + focus(c); | |
48 + restack(selmon); | |
49 + } | |
50 } | |
51 } | |
52 | |
53 -- | |
54 2.15.1 | |
55 |