summaryrefslogtreecommitdiff
path: root/patches/alwayscenter.patch
diff options
context:
space:
mode:
authormac <ra@afu.re>2025-08-28 13:46:10 -0400
committermac <ra@afu.re>2025-08-28 13:46:10 -0400
commitff7bfc16f67c9afd20ae65e9d0457fc6fbf1178f (patch)
tree4f8adb3d8c3fe873f1165b437ecbb8f1515ec1b5 /patches/alwayscenter.patch
parentc89733a225af7b80c08955e485f6a373f45bc9b3 (diff)
adding patches to patches dir
Diffstat (limited to 'patches/alwayscenter.patch')
-rw-r--r--patches/alwayscenter.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/patches/alwayscenter.patch b/patches/alwayscenter.patch
new file mode 100644
index 0000000..f88ad9c
--- /dev/null
+++ b/patches/alwayscenter.patch
@@ -0,0 +1,38 @@
+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 | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/dwl.c b/dwl.c
+index 12f441e..c377c67 100644
+--- a/dwl.c
++++ b/dwl.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);
+ }
+@@ -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) {
++ c->geom.x = (p->mon->w.width - c->geom.width) / 2 + p->mon->m.x;
++ c->geom.y = (p->mon->w.height - c->geom.height) / 2 + p->mon->m.y;
++ }
+ setmon(c, p->mon, p->tags);
+ } else {
+ applyrules(c);
+--
+2.49.0