Configure geometry before applying rules
authorEric Pruitt <eric.pruitt@gmail.com>
Wed, 25 May 2016 23:33:11 +0000 (16:33 -0700)
committerAnselm R Garbe <anselm@garbe.us>
Fri, 24 Jun 2016 03:38:58 +0000 (05:38 +0200)
Configuring geometry before applying rules makes it possible to have
more complex constraints in applyrules that depend on the initial window
dimensions and location.

dwm.c

diff --git a/dwm.c b/dwm.c
index ff7e096..9585683 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -1043,6 +1043,13 @@ manage(Window w, XWindowAttributes *wa)
 
        c = ecalloc(1, sizeof(Client));
        c->win = w;
+       /* geometry */
+       c->x = c->oldx = wa->x;
+       c->y = c->oldy = wa->y;
+       c->w = c->oldw = wa->width;
+       c->h = c->oldh = wa->height;
+       c->oldbw = wa->border_width;
+
        updatetitle(c);
        if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
                c->mon = t->mon;
@@ -1051,12 +1058,6 @@ manage(Window w, XWindowAttributes *wa)
                c->mon = selmon;
                applyrules(c);
        }
-       /* geometry */
-       c->x = c->oldx = wa->x;
-       c->y = c->oldy = wa->y;
-       c->w = c->oldw = wa->width;
-       c->h = c->oldh = wa->height;
-       c->oldbw = wa->border_width;
 
        if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
                c->x = c->mon->mx + c->mon->mw - WIDTH(c);