[wiki] [sites] [dwm][focusonnetactive] Minor multi-monitor fix for the focusonnetactive patch || bakkeby

From: <git_AT_suckless.org>
Date: Thu, 23 Apr 2020 10:58:37 +0200

commit 1da8d0eb5bfd26207906e715f56c93320f02b6c6
Author: bakkeby <bakkeby_AT_gmail.com>
Date: Thu Apr 23 10:54:17 2020 +0200

    [dwm][focusonnetactive] Minor multi-monitor fix for the focusonnetactive patch
    
    In a multi-monitor setup you can have an application starting up on tag 8 on monitor 1. With the original patch if the selected monitor was monitor 2 at the time, then you'd view tag 8 on monitor 2 rather than monitor 1 where the application started.
    
    This is a minor fix to change the selected monitor to that of the client before viewing the tag.

diff --git a/dwm.suckless.org/patches/focusonnetactive/dwm-focusonnetactive-6.2.diff b/dwm.suckless.org/patches/focusonnetactive/dwm-focusonnetactive-6.2.diff
new file mode 100644
index 00000000..5d358d20
--- /dev/null
+++ b/dwm.suckless.org/patches/focusonnetactive/dwm-focusonnetactive-6.2.diff
_AT_@ -0,0 +1,57 @@
+From 286ca3bb1af08b452bf8140abcc23d4ef61baaa2 Mon Sep 17 00:00:00 2001
+From: bakkeby <bakkeby_AT_gmail.com>
+Date: Tue, 7 Apr 2020 12:33:04 +0200
+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 | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index 4465af1..3919d47 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -514,6 +514,7 @@ clientmessage(XEvent *e)
+ {
+ XClientMessageEvent *cme = &e->xclient;
+ Client *c = wintoclient(cme->window);
++ unsigned int i;
+
+ if (!c)
+ return;
+_AT_@ -523,8 +524,14 @@ 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};
++ selmon = c->mon;
++ view(&a);
++ focus(c);
++ restack(selmon);
++ }
+ }
+ }
+
+--
+2.17.1
+
diff --git a/dwm.suckless.org/patches/focusonnetactive/index.md b/dwm.suckless.org/patches/focusonnetactive/index.md
index 75efac80..62f9469d 100644
--- a/dwm.suckless.org/patches/focusonnetactive/index.md
+++ b/dwm.suckless.org/patches/focusonnetactive/index.md
_AT_@ -21,6 +21,7 @@ management utilities.
 
 Download
 --------
+* [dwm-focusonnetactive-6.2.diff](dwm-focusonnetactive-6.2.diff)
 * [dwm-focusonnetactive-2017-12-24-3756f7f.diff](dwm-focusonnetactive-2017-12-24-3756f7f.diff)
 
 Author
Received on Thu Apr 23 2020 - 10:58:37 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 23 2020 - 11:00:51 CEST