mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-01-30 04:37:28 -08:00
center floating windows
Credits to Benjamin Chausse for fixing this with multiple monitors. Modified-by: Leonardo Hernández Hernández <leohdz172@proton.me>
This commit is contained in:
parent
4932666c65
commit
519ef45428
1 changed files with 6 additions and 0 deletions
6
dwl.c
6
dwl.c
|
@ -473,6 +473,8 @@ applyrules(Client *c)
|
|||
}
|
||||
}
|
||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
|
||||
c->geom.x = mon ? (mon->w.width - c->geom.width) / 2 + mon->m.x : 0;
|
||||
c->geom.y = mon ? (mon->w.height - c->geom.height) / 2 + mon->m.y : 0;
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
|
@ -1744,6 +1746,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
|||
if (c->type == XDGShell && (p = client_get_parent(c))) {
|
||||
c->isfloating = 1;
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]);
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue