center floating windows

This commit is contained in:
Guido Cella 2024-06-05 12:05:16 +02:00 committed by luna
parent 74e45c4014
commit 1de88b44e2

8
dwl.c
View file

@ -478,6 +478,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);
}
@ -1734,6 +1738,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);