Since dwm doesn't expose enough of the X11 properties to use Devil's
Pie, I am using changes inside of applyrules to modify window locations
and geometry. As part of my changes, I needed client geometry properties
to be set before the applyrules function is called because I need to
know where a window is initially located to determine if it needs to be
modified. I don't see anything that indicates the geometry assignments
**must** occur before calling applyrules, so I think it would be a good
to move the geometry assignments permanently in the suckless repo; most
people "configure" dwm by patching it, and this change would make it
easier to add more complex constraints to applyrules. I've attached a
patch with this change to my email.

Eric
>From da2a02dd23befc0ff89d08c990a360c048f0adfd Mon Sep 17 00:00:00 2001
From: Eric Pruitt <[email protected]>
Date: Wed, 25 May 2016 16:33:11 -0700
Subject: [PATCH] Configure geometry before applying rules

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 | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/dwm.c b/dwm.c
index ff7e096..9585683 100644
--- 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);
-- 
2.1.4

Reply via email to