[hackers] [dwm] center floating windows || Daniel Cousens

From: <git_AT_suckless.org>
Date: Wed, 11 Oct 2017 09:19:32 +0200 (CEST)

commit dc86b9d3beecb37dacef22c075a68990d55a532d
Author: Daniel Cousens <github_AT_dcousens.com>
AuthorDate: Mon Apr 24 10:38:32 2017 +1000
Commit: Daniel Cousens <github_AT_dcousens.com>
CommitDate: Wed Oct 11 07:55:14 2017 +1100

    center floating windows

diff --git a/dwm.c b/dwm.c
index e45b33d..41c4914 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -1039,6 +1039,15 @@ manage(Window w, XWindowAttributes *wa)
                 c->isfloating = c->oldstate = trans != None || c->isfixed;
         if (c->isfloating)
                 XRaiseWindow(dpy, c->win);
+ if (c->isfloating && c->x == 0 && c->y == (c->mon->showbar ? bh : 0)) {
+ if (t) {
+ c->x = t->x + WIDTH(t) / 2 - WIDTH(c) / 2;
+ c->y = t->y + HEIGHT(t) / 2 - HEIGHT(c) / 2;
+ } else {
+ c->x = c->mon->mx + (c->mon->mw / 2 - WIDTH(c) / 2);
+ c->y = c->mon->my + (c->mon->mh / 2 - HEIGHT(c) / 2);
+ }
+ }
         attach(c);
         attachstack(c);
         XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
Received on Wed Oct 11 2017 - 09:19:32 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 11 2017 - 09:24:52 CEST