--- a/dwm.c 2011-12-19 16:02:46.000000000 +0100 +++ b/dwm.c 2012-09-05 14:28:36.379761297 +0200 @@ -424,6 +424,15 @@ } void +attach2stack(Client *c) { + Client *t; + + for(t = c->mon->stack; t->snext; t = t->snext); + t->snext = c; + c->snext = NULL; +} + +void buttonpress(XEvent *e) { unsigned int i, x, click; Arg arg = {0}; @@ -853,7 +862,10 @@ if(c->isurgent) clearurgent(c); detachstack(c); - attachstack(c); + if(c->tags != TAGMASK) + attachstack(c); + else + attach2stack(c); grabbuttons(c, True); XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); setfocus(c);