[wiki] [sites] dwm: add focusonnetactive patch || Danny O'Brien

From: <git_AT_suckless.org>
Date: Sun, 24 Dec 2017 22:20:18 +0100

commit 671c95dfcc5773fe211e965719c8476983594cbf
Author: Danny O'Brien <danny_AT_spesh.com>
Date: Sun Dec 24 13:19:27 2017 -0800

    dwm: add focusonnetactive patch

diff --git a/dwm.suckless.org/patches/focusonnetactive/dwm-focusonnetactive-2017-12-24-3756f7f.diff b/dwm.suckless.org/patches/focusonnetactive/dwm-focusonnetactive-2017-12-24-3756f7f.diff
new file mode 100644
index 00000000..f88d4246
--- /dev/null
+++ b/dwm.suckless.org/patches/focusonnetactive/dwm-focusonnetactive-2017-12-24-3756f7f.diff
_AT_@ -0,0 +1,55 @@
+From cda7fd4e732c6db03180301e45b48b961fda5eba Mon Sep 17 00:00:00 2001
+From: Danny O'Brien <danny_AT_spesh.com>
+Date: Sat, 23 Dec 2017 16:45:29 -0800
+Subject: [PATCH] Activate a window in response to _NET_ACTIVE_WINDOW
+
+By default, dwm response to client requests to _NET_ACTIVE_WINDOW client
+messages by setting the urgency bit on the named window.
+
+This patch activates the window instead.
+
+Both behaviours are legitimate according to
+https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472702304
+
+One should decide which of these one should perform based on the message
+senders' untestable claims that it represents the end-user. Setting the
+urgency bit is the conservative decision. This patch implements the more
+trusting alternative.
+
+It also allows dwm to work with `wmctrl -a` and other external window
+management utilities.
+---
+ dwm.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index ff893df..b278182 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -515,6 +515,7 @@ clientmessage(XEvent *e)
+ {
+ XClientMessageEvent *cme = &e->xclient;
+ Client *c = wintoclient(cme->window);
++ unsigned int i;
+
+ if (!c)
+ return;
+_AT_@ -524,8 +525,13 @@ clientmessage(XEvent *e)
+ setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
+ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
+ } else if (cme->message_type == netatom[NetActiveWindow]) {
+- if (c != selmon->sel && !c->isurgent)
+- seturgent(c, 1);
++ for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
++ if (i < LENGTH(tags)) {
++ const Arg a = {.ui = 1 << i};
++ view(&a);
++ focus(c);
++ restack(selmon);
++ }
+ }
+ }
+
+--
+2.15.1
+
diff --git a/dwm.suckless.org/patches/focusonnetactive/index.md b/dwm.suckless.org/patches/focusonnetactive/index.md
new file mode 100644
index 00000000..f6af2601
--- /dev/null
+++ b/dwm.suckless.org/patches/focusonnetactive/index.md
_AT_@ -0,0 +1,26 @@
+# focusonnetactive
+
+## Description
+
+By default, dwm response to client requests to _NET_ACTIVE_WINDOW client
+messages by setting the urgency bit on the named window.
+
+This patch activates the window instead.
+
+Both behaviours are legitimate according to the [curséd spec](https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472702304)
+
+One should decide which of these one should perform based on the message
+senders' untestable claims that it represents the end-user. Setting the
+urgency bit is the conservative decision. This patch implements the more
+trusting alternative.
+
+It also allows dwm to work with `wmctrl -a` and other external window
+management utilities.
+
+## Download
+
+ * [dwm-focusonnetactive-2017-12-24-3756f7f.diff](dwm-focusonnetactive-2017-12-24-3756f7f.diff)
+
+## Author
+
+ * [Danny O'Brien](http://www.spesh.com/danny/) <danny_AT_spesh.com>
Received on Sun Dec 24 2017 - 22:20:18 CET

This archive was generated by hypermail 2.3.0 : Sun Dec 24 2017 - 22:24:21 CET