Hello,

I have modified Mate Nagy's "attach above" patch[1] for DWM into a new
"attach below" patch (attached) to emulate WMII's behavior of attaching
new clients below the currently focused one.

Cheers.

[1]: http://dwm.suckless.org/patches/attachabove

-- 
Old mail has arrived.
diff --git a/dwm.c b/dwm.c
index 1d78655..d4c6fa6 100644
--- a/dwm.c
+++ b/dwm.c
@@ -160,6 +160,7 @@ static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool inter
 static void arrange(Monitor *m);
 static void arrangemon(Monitor *m);
 static void attach(Client *c);
+static void attachbelow(Client *c);
 static void attachstack(Client *c);
 static void buttonpress(XEvent *e);
 static void checkotherwm(void);
@@ -418,6 +419,17 @@ attach(Client *c) {
 }
 
 void
+attachbelow(Client *c) {
+	Client *at = c->mon->sel;
+	if(at == NULL || at->isfloating) {
+		attach(c);
+		return;
+	}
+	c->next = at->next;
+	at->next = c;
+}
+
+void
 attachstack(Client *c) {
 	c->snext = c->mon->stack;
 	c->mon->stack = c;
@@ -1155,7 +1167,7 @@ manage(Window w, XWindowAttributes *wa) {
 		c->isfloating = c->oldstate = trans != None || c->isfixed;
 	if(c->isfloating)
 		XRaiseWindow(dpy, c->win);
-	attach(c);
+	attachbelow(c);
 	attachstack(c);
 	XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
 	setclientstate(c, NormalState);

Attachment: signature.asc
Description: PGP signature

Reply via email to