Hi all,
this is a patch against current hg that attaches new clients above the
current focused client, as opposed to as master every time. (This is how
xmonad behaves).
Regards,
Mate
diff -r 4fff5050c835 dwm.c
--- a/dwm.c Thu Jul 02 20:56:23 2009 +0100
+++ b/dwm.c Sun Jul 05 15:54:30 2009 +0200
@@ -151,6 +151,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 attachabove(Client *c);
static void attachstack(Client *c);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
@@ -389,6 +390,19 @@
}
void
+attachabove(Client *c) {
+ if(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating) {
+ attach(c);
+ return;
+ }
+
+ Client *at;
+ for (at = c->mon->clients; at->next != c->mon->sel; at = at->next);
+ c->next = at->next;
+ at->next = c;
+}
+
+void
attachstack(Client *c) {
c->snext = c->mon->stack;
c->mon->stack = c;
@@ -1094,7 +1108,7 @@
c->isfloating = trans != None || c->isfixed;
if(c->isfloating)
XRaiseWindow(dpy, c->win);
- attach(c);
+ attachabove(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);