From 202edd8b7056cdeca02dbef0c165ce1986f7844e Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Fri, 16 Mar 2012 03:42:39 +0200 Subject: focus clients with urgent hint on other desktops --- monsterwm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'monsterwm.c') diff --git a/monsterwm.c b/monsterwm.c index 00027af..52cbd61 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -565,12 +565,15 @@ void focusin(XEvent *e) { } /** - * find and focus the first client which received - * an urgent hint in the current desktop + * find and focus the first client that received an urgent hint + * first look in the current desktop then on other desktops */ void focusurgent(void) { - Desktop *d = &desktops[currdeskidx]; - for (Client *c = d->head; c; c = c->next) if (c->isurgn) focus(c, d); + Client *c = NULL; + int d = -1; + for (c = desktops[currdeskidx].head; c && !c->isurgn; c = c->next); + while (!c && d < DESKTOPS-1) for (c = desktops[++d].head; c && !c->isurgn; c = c->next); + if (c) { if (d != -1) change_desktop(&(Arg){.i = d}); focus(c, &desktops[currdeskidx]); } } /** -- cgit v1.3.1