Center floating windows

Credits to Benjamin Chausse for fixing this with multiple monitors.
This commit is contained in:
Guido Cella 2021-04-17 08:59:55 +02:00 committed by Leonardo Hernández Hernández
parent a0a4d8266f
commit 24f702fbc1
No known key found for this signature in database
GPG Key ID: E538897EE11B9624

4
dwl.c
View File

@ -519,6 +519,8 @@ applyrules(Client *c)
mon = m;
}
}
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;
wlr_scene_node_reparent(c->scene, layers[c->isfloating ? LyrFloat : LyrTile]);
setmon(c, mon, newtags);
}
@ -1667,6 +1669,8 @@ mapnotify(struct wl_listener *listener, void *data)
c->isfloating = 1;
wlr_scene_node_reparent(c->scene, layers[LyrFloat]);
setmon(c, p->mon, p->tags);
c->geom.x = (c->mon->w.width - c->geom.width) / 2 + c->mon->m.x;
c->geom.y = (c->mon->w.height - c->geom.height) / 2 + c->mon->m.y;
} else {
applyrules(c);
}