From 7a874be1c656529fd6dd3c0cbe83a8ff457156ef Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 23 Nov 2020 19:57:52 +0100 Subject: [PATCH] Made new windows spawn in center --- src/dwm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dwm.c b/src/dwm.c index 6d82cba..9f19db8 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -1132,6 +1132,10 @@ manage(Window w, XWindowAttributes *wa) c->bw = borderpx; wc.border_width = c->bw; + + if(c->x == selmon->wx) c->x += (c->mon->ww - WIDTH(c)) / 2 - c->bw; + if(c->y == selmon->wy) c->y += (c->mon->wh - HEIGHT(c)) / 2 - c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); configure(c); /* propagates border_width, if size doesn't change */