aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-03-16 03:42:39 +0200
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-12-16 02:11:13 +0200
commit202edd8b7056cdeca02dbef0c165ce1986f7844e (patch)
tree71b3653b8bf84fbf1a8f0b1d5c24488e2a93f634
parent56c613830041d6902d97ac93f8bb7eb704d95039 (diff)
focus clients with urgent hint on other desktops
-rw-r--r--monsterwm.c11
1 files changed, 7 insertions, 4 deletions
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]); }
}
/**