dotfiles-mirror/dwm/patch/movecenter.c

16 lines
326 B
C
Raw Permalink Normal View History

2026-02-05 03:05:24 +03:30
void
movecenter(const Arg *arg)
{
Client *c = selmon->sel;
XEvent ev;
if (!c || !c->isfloating)
return;
c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XMoveWindow(dpy, c->win, c->x, c->y);
XSync(dpy, False);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}