update alwayscenter

This commit is contained in:
Guido Cella 2024-06-05 12:05:52 +02:00
parent e8e969a564
commit 6af0e5e209
2 changed files with 26 additions and 15 deletions

View File

@ -3,7 +3,7 @@ Automatically center floating windows.
### Download ### Download
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/alwayscenter) - [git branch](https://codeberg.org/guidocella/dwl/src/branch/alwayscenter)
- [2024-06-01](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/alwayscenter/alwayscenter.patch) - [2024-06-05](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/alwayscenter/alwayscenter.patch)
### Authors ### Authors
- [Guido Cella](https://codeberg.org/guidocella) - [Guido Cella](https://codeberg.org/guidocella)

View File

@ -1,27 +1,38 @@
From 5a96a47d708e94f1789daed2c1342279aa930d2f Mon Sep 17 00:00:00 2001 From 6616470ef135019ef4c767003a66df76df45f53e Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Sat, 1 Jun 2024 23:46:06 +0200 Date: Wed, 5 Jun 2024 12:05:16 +0200
Subject: [PATCH] center floating windows Subject: [PATCH] center floating windows
--- ---
dwl.c | 4 ++++ dwl.c | 8 ++++++++
1 file changed, 4 insertions(+) 1 file changed, 8 insertions(+)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 52bfbc8..c912b04 100644 index 6f041a0..79ace52 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -1618,6 +1618,10 @@ mapnotify(struct wl_listener *listener, void *data) @@ -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 { } else {
applyrules(c); applyrules(c);
}
+ if (c->mon) {
+ c->geom.x = (c->mon->w.width - c->geom.width) / 2 + c->mon->m.x;
+ c->geom.y = (c->mon->w.height - c->geom.height) / 2 + c->mon->m.y;
+ }
printstatus();
unset_fullscreen:
-- --
2.45.1 2.45.1