On Sat, Mar 09, 2013 at 10:24:13PM +0100, Markus Teich wrote:
> Am 09.03.2013 21:30, schrieb Andreas Amann:
> > On Mon, Mar 04, 2013 at 11:36:57AM +0100, Markus Teich wrote:
> >> Hi,
> >>
> >> a month ago i started using dwm.
> >> In my rules i send firefox clients to tag 2.
> >> Now, after starting dwm i am on tag 1 and after i started firefox via
> >> dmenu, i automatically get switched to tag 2.
> > 
> > Do you also get switched to tag 2, if you start firefox from a terminal in
> > tag 1?
> 
> Yes and also when opening a new tab in the running firefox from a
> different dwm tag.

In this case you can try the attached patch.  Does this solve the problem?
This patch allows _NET_ACTIVE_WINDOW messages from pagers only.  Unless your
application poses as a pager, it should therefore not cause a switch. 

Andreas

>From 561a22a055d571f533562e217cdfccd8f64794d2 Mon Sep 17 00:00:00 2001
From: Andreas Amann <[email protected]>
Date: Sun, 10 Mar 2013 00:40:15 +0000
Subject: [PATCH] only allow to switch to new window when requested by a tool

according to http://standards.freedesktop.org/wm-spec the
_NET_ACTIVE_WINDOW message contains in data.l[0] a source indication,
which should be 1 when the request comes from an application, and 2
when it comes from a pager.  We only honour focus change requests, if
they come from a pager.
---
 dwm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dwm.c b/dwm.c
index bd25d10..2c20478 100644
--- a/dwm.c
+++ b/dwm.c
@@ -542,7 +542,7 @@ 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]) {
+	else if(cme->message_type == netatom[NetActiveWindow] && cme->data.l[0] == 2) {
 		if(!ISVISIBLE(c)) {
 			c->mon->seltags ^= 1;
 			c->mon->tagset[c->mon->seltags] = c->tags;
-- 
1.8.1.2

Reply via email to