From 07e4c047eb7cddf10a3a3ef0f396a6b7db658f1c Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Sun, 29 Sep 2024 11:26:04 +0530 Subject: (patch): alwayscenter.patch --- dwl.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index dc0c861..babb30f 100644 --- a/dwl.c +++ b/dwl.c @@ -474,6 +474,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); } @@ -1731,6 +1735,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); -- cgit v1.2.3