summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2024-07-22 22:59:03 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2024-07-22 22:59:03 -0400
commit2008f6415d4d7bd350213c799310a15f0e09dd11 (patch)
tree9f3d75b766009d86d852f749ea5f89261a89fbc3
parent2971880e6e59ee554ba45f137a0f22b406a94a1a (diff)
Implement alwayscenter patch
https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/alwayscenter/alwayscenter.patch
-rw-r--r--dwl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index 6b97a7e..caec0d7 100644
--- a/dwl.c
+++ b/dwl.c
@@ -494,6 +494,10 @@ applyrules(Client *c)
}
}
}
+ 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);
}
@@ -1837,6 +1841,10 @@ mapnotify(struct wl_listener *listener, void *data)
* try to apply rules for them */
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);