diff -r 9f79d36bd5e0 dwm.c
--- a/dwm.c	Tue Sep 08 13:33:58 2009 +0100
+++ b/dwm.c	Tue Sep 15 14:19:26 2009 +0200
@@ -153,6 +153,7 @@
 static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
 static void arrange(void);
 static void attach(Client *c);
+static void attachaside(Client *c);
 static void attachstack(Client *c);
 static void buttonpress(XEvent *e);
 static void checkotherwm(void);
@@ -397,6 +398,17 @@
 }
 
 void
+attachaside(Client *c) {
+	Client *at = nexttiled(c->mon->clients);;
+	if(c->mon->sel == NULL || c->mon->sel->isfloating || !at) {
+		attach(c);
+		return;
+	}
+	c->next = at->next;
+	at->next = c;
+}
+
+void
 attachstack(Client *c) {
 	c->snext = c->mon->stack;
 	c->mon->stack = c;
@@ -1105,7 +1117,7 @@
 		c->isfloating = trans != None || c->isfixed;
 	if(c->isfloating)
 		XRaiseWindow(dpy, c->win);
-	attach(c);
+	attachaside(c);
 	attachstack(c);
 	XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
 	XMapWindow(dpy, c->win);
