alwayscenter.patch 966 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 6616470ef135019ef4c767003a66df76df45f53e Mon Sep 17 00:00:00 2001
  2. From: Guido Cella <guido@guidocella.xyz>
  3. Date: Wed, 5 Jun 2024 12:05:16 +0200
  4. Subject: [PATCH] center floating windows
  5. ---
  6. dwl.c | 8 ++++++++
  7. 1 file changed, 8 insertions(+)
  8. diff --git a/dwl.c b/dwl.c
  9. index 6f041a0..79ace52 100644
  10. --- a/dwl.c
  11. +++ b/dwl.c
  12. @@ -472,6 +472,10 @@ applyrules(Client *c)
  13. }
  14. }
  15. }
  16. + if (mon) {
  17. + c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
  18. + c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
  19. + }
  20. setmon(c, mon, newtags);
  21. }
  22. @@ -1677,6 +1681,10 @@ mapnotify(struct wl_listener *listener, void *data)
  23. * try to apply rules for them */
  24. if ((p = client_get_parent(c))) {
  25. c->isfloating = 1;
  26. + if (p->mon) {
  27. + c->geom.x = (p->mon->w.width - c->geom.width) / 2 + p->mon->m.x;
  28. + c->geom.y = (p->mon->w.height - c->geom.height) / 2 + p->mon->m.y;
  29. + }
  30. setmon(c, p->mon, p->tags);
  31. } else {
  32. applyrules(c);
  33. --
  34. 2.45.1