aboutsummaryrefslogtreecommitdiffstats
path: root/patches/alwayscenter.patch
blob: 962745de08732d45b2e1cdf27da66e51bb5c8723 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From 48110f0443c8e1ddcd56b6fed5da46535024919c Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz>
Date: Tue, 13 Jan 2026 21:17:22 +0100
Subject: [PATCH] center floating windows

---
 dwl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dwl.c b/dwl.c
index 44f3ad9..72714f8 100644
--- a/dwl.c
+++ b/dwl.c
@@ -2414,6 +2414,8 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
 		/* Make sure window actually overlaps with the monitor */
 		resize(c, c->geom, 0);
 		c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */
+		c->prev.x = (m->w.width - c->prev.width) / 2 + m->m.x;
+		c->prev.y = (m->w.height - c->prev.height) / 2 + m->m.y;
 		setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
 		setfloating(c, c->isfloating);
 	}
-- 
2.52.0