summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornic <ra@afu.re>2025-08-26 10:10:40 -0400
committernic <ra@afu.re>2025-08-26 10:10:40 -0400
commit9a23ae35025698adca57db2e28abcdc7a721a988 (patch)
tree1f95c25d9301160957d83a8e191af3f3001c6509
parenta967f8c4011b94bb66b965de1af4e569d9035d4e (diff)
alwayscentered patch applied
-rw-r--r--dwl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index 059aeeb..a662911 100644
--- a/dwl.c
+++ b/dwl.c
@@ -571,6 +571,12 @@ applyrules(Client *c)
if (p)
swallow(c, p);
}
+
+ /* Center floating windows on their monitor */
+ if (mon) {
+ c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
+ c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
+ }
setmon(c, mon, newtags);
}
@@ -2166,6 +2172,10 @@ mapnotify(struct wl_listener *listener, void *data)
* If there is no parent, apply rules */
if ((p = client_get_parent(c))) {
c->isfloating = 1;
+ if (p->mon) {
+ c->geom.x = (p->mon->w.width - c->geom.width) / 2 + p->mon->m.x;
+ c->geom.y = (p->mon->w.height - c->geom.height) / 2 + p->mon->m.y;
+ }
setmon(c, p->mon, p->tags);
} else {
applyrules(c);