summaryrefslogtreecommitdiff
path: root/dwl/dwl-patches/patches/alwayscenter
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwl/dwl-patches/patches/alwayscenter
Diffstat (limited to 'dwl/dwl-patches/patches/alwayscenter')
-rwxr-xr-xdwl/dwl-patches/patches/alwayscenter/README.md9
-rwxr-xr-xdwl/dwl-patches/patches/alwayscenter/alwayscenter.patch39
2 files changed, 48 insertions, 0 deletions
diff --git a/dwl/dwl-patches/patches/alwayscenter/README.md b/dwl/dwl-patches/patches/alwayscenter/README.md
new file mode 100755
index 0000000..63d6f86
--- /dev/null
+++ b/dwl/dwl-patches/patches/alwayscenter/README.md
@@ -0,0 +1,9 @@
+### Description
+Automatically center floating windows.
+
+### Download
+- [git branch](https://codeberg.org/guidocella/dwl/src/branch/alwayscenter)
+- [2024-06-05](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/alwayscenter/alwayscenter.patch)
+
+### Authors
+- [Guido Cella](https://codeberg.org/guidocella)
diff --git a/dwl/dwl-patches/patches/alwayscenter/alwayscenter.patch b/dwl/dwl-patches/patches/alwayscenter/alwayscenter.patch
new file mode 100755
index 0000000..59a83dc
--- /dev/null
+++ b/dwl/dwl-patches/patches/alwayscenter/alwayscenter.patch
@@ -0,0 +1,39 @@
+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
+