update alwayscenter

This commit is contained in:
Guido Cella 2025-06-14 23:15:32 +02:00
parent 927ed93711
commit 1d16e63d46

View File

@ -1,29 +1,30 @@
From 6616470ef135019ef4c767003a66df76df45f53e Mon Sep 17 00:00:00 2001
From f43a49324c2ddd21100d6308d1adde9d894746e2 Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz>
Date: Wed, 5 Jun 2024 12:05:16 +0200
Subject: [PATCH] center floating windows
---
dwl.c | 8 ++++++++
1 file changed, 8 insertions(+)
dwl.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dwl.c b/dwl.c
index 6f041a0..79ace52 100644
index 12f441e..c377c67 100644
--- a/dwl.c
+++ b/dwl.c
@@ -472,6 +472,10 @@ applyrules(Client *c)
}
@@ -499,6 +499,11 @@ applyrules(Client *c)
}
}
+ if (mon) {
+ c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
+ c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
+ }
+
c->isfloating |= client_is_float_type(c);
setmon(c, mon, newtags);
}
@@ -1677,6 +1681,10 @@ mapnotify(struct wl_listener *listener, void *data)
* try to apply rules for them */
@@ -1787,6 +1792,10 @@ mapnotify(struct wl_listener *listener, void *data)
* If there is no parent, apply rules */
if ((p = client_get_parent(c))) {
c->isfloating = 1;
+ if (p->mon) {
@ -34,5 +35,5 @@ index 6f041a0..79ace52 100644
} else {
applyrules(c);
--
2.45.1
2.49.0