summaryrefslogtreecommitdiffstats
path: root/patches/applied/alwayscenter.patch
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2025-03-01 23:35:40 +0100
committerJoe <rbo@gmx.us>2025-03-01 23:35:40 +0100
commit80a2d8a025979931fd44c06089f55c52ec446f03 (patch)
tree278895ee7be0c35cc4ac332c3c66ec821af9b7cb /patches/applied/alwayscenter.patch
parentscratchpads yey (diff)
downloaddwl-80a2d8a025979931fd44c06089f55c52ec446f03.tar.gz
dwl-80a2d8a025979931fd44c06089f55c52ec446f03.tar.bz2
dwl-80a2d8a025979931fd44c06089f55c52ec446f03.tar.xz
dwl-80a2d8a025979931fd44c06089f55c52ec446f03.tar.zst
dwl-80a2d8a025979931fd44c06089f55c52ec446f03.zip
centered
Diffstat (limited to 'patches/applied/alwayscenter.patch')
-rw-r--r--patches/applied/alwayscenter.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/patches/applied/alwayscenter.patch b/patches/applied/alwayscenter.patch
new file mode 100644
index 0000000..a046ef7
--- /dev/null
+++ b/patches/applied/alwayscenter.patch
@@ -0,0 +1,38 @@
+From 6616470ef135019ef4c767003a66df76df45f53e 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(+)
+
+diff --git a/dwl.c b/dwl.c
+index 6f041a0..79ace52 100644
+--- a/dwl.c
++++ b/dwl.c
+@@ -472,6 +472,10 @@ 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;
++ }
+ setmon(c, mon, newtags);
+ }
+
+@@ -1677,6 +1681,10 @@ mapnotify(struct wl_listener *listener, void *data)
+ * try to apply rules for them */
+ 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.45.1
+