dwm

dynamic window manager

git clone https://9o.is/git/dwm.git

commit 9fe72f38758c54ecad1af757a3729043ddb95e91
parent 5bfe0d167b6b0ada88f0b9aa25f2369eb4711850
Author: Jul <jul@9o.is>
Date:   Sun,  1 Feb 2026 03:20:08 -0500

always center floating windows

Diffstat:
Mdwm.c | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/dwm.c b/dwm.c @@ -227,6 +227,7 @@ static void updatestatus(void); static void updatetitle(Client *c); static void updatewindowtype(Client *c); static void updatewmhints(Client *c); +static void updatecentered(Client *c); static void view(const Arg *arg); static Client *wintoclient(Window w); static Monitor *wintomon(Window w); @@ -1071,6 +1072,7 @@ manage(Window w, XWindowAttributes *wa) updatewindowtype(c); updatesizehints(c); updatewmhints(c); + updatecentered(c); XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); grabbuttons(c, 0); if (!c->isfloating) @@ -2081,6 +2083,13 @@ updatewmhints(Client *c) } void +updatecentered(Client *c) +{ + c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2; + c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; +} + +void view(const Arg *arg) { if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])