X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=f123400cc874a8f582fc1d0cdf000dafab9c1ec5;hp=f8467d6116d9ed3202324093d4c697dfd0fe8915;hb=0f44b250c447cf79c42b0bd7533ffa2b8bacf04c;hpb=491b0978baa9a688aec49ab8b365df7a8be2537b diff --git a/dwm.c b/dwm.c index f8467d6..f123400 100644 --- a/dwm.c +++ b/dwm.c @@ -695,9 +695,10 @@ detachstack(Client *c) { // WARNING if you detach() before detachstack() this will select last visible window for(i = nextvisible(c->mon->clients); i && i != c; i = nextvisible(i->next)) next_sel = i; - // failing that, find first visible window + // failing that, find first visible window (besides c) if (!next_sel) - for(i = nextvisible(c->mon->clients); i && i != c; i = nextvisible(i->next)) + for(i = nextvisible(c->mon->clients); i && i == c; i = nextvisible(i->next)); + if (i != c) next_sel = i; c->mon->sel = next_sel; }