Add focusonactive patch to DWM
When an application tags itself as "active" i.e. has something to do, this patch will ensure that we're focused on it. Works on multiple monitors!
This commit is contained in:
11
dwm.c
11
dwm.c
@@ -571,6 +571,7 @@ clientmessage(XEvent *e)
|
||||
{
|
||||
XClientMessageEvent *cme = &e->xclient;
|
||||
Client *c = wintoclient(cme->window);
|
||||
unsigned int i;
|
||||
|
||||
if (!c)
|
||||
return;
|
||||
@@ -585,8 +586,14 @@ clientmessage(XEvent *e)
|
||||
setsticky(c, (cme->data.l[0] == 1 ||
|
||||
(cme->data.l[0] == 2 && !c->issticky)));
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user