diff --git a/sowm.c b/sowm.c index 9b2e293..43a6b43 100644 --- a/sowm.c +++ b/sowm.c @@ -267,13 +267,12 @@ void win_next() { Window cur = win_current(); client *c; - if (head) { - for WIN if (c->win == cur) break; + if (!head) return; + if (cur == root) cur = head->win; - c = c->next; - - if (!c) c = head; + for WIN if (c->win == cur) break; + if ((c = c->next ? c->next : head)) { XSetInputFocus(dis, c->win, RevertToParent, CurrentTime); XRaiseWindow(dis, c->win); }