diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-06-03 15:40:37 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-06-03 15:40:37 +0200 |
commit | d861b36018e978de024586f8a0a095a07f29ebf2 (patch) | |
tree | d1f401930825383c8dbbaf6ae70def988c8739b6 /dwm.c | |
parent | 9473946e6ce11ca360621bad7beac3dd41b9038e (diff) | |
download | dwm-d861b36018e978de024586f8a0a095a07f29ebf2.tar.gz dwm-d861b36018e978de024586f8a0a095a07f29ebf2.tar.bz2 dwm-d861b36018e978de024586f8a0a095a07f29ebf2.zip |
update
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -114,7 +114,7 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; int bw, oldbw; unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow; + int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow; pid_t pid; Client *next; Client *snext; @@ -161,6 +161,7 @@ typedef struct { const char *instance; const char *title; unsigned int tags; + int iscentered; int isfloating; int isterminal; int noswallow; @@ -339,6 +340,7 @@ applyrules(Client *c) XClassHint ch = { NULL, NULL }; /* rule matching */ + c->iscentered = 0; c->isfloating = 0; c->tags = 0; XGetClassHint(dpy, c->win, &ch); @@ -351,9 +353,10 @@ applyrules(Client *c) && (!r->class || strstr(class, r->class)) && (!r->instance || strstr(instance, r->instance))) { + c->iscentered = r->iscentered; + c->isfloating = r->isfloating; c->isterminal = r->isterminal; c->noswallow = r->noswallow; - c->isfloating = r->isfloating; c->tags |= r->tags; for (m = mons; m && m->num != r->monitor; m = m->next); if (m) @@ -1328,6 +1331,10 @@ manage(Window w, XWindowAttributes *wa) updatewindowtype(c); updatesizehints(c); updatewmhints(c); + if (c->iscentered) { + c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2; + c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; + } { int format; unsigned long *data, n, extra; @@ -2468,8 +2475,10 @@ updatewindowtype(Client *c) if (state == netatom[NetWMFullscreen]) setfullscreen(c, 1); - if (wtype == netatom[NetWMWindowTypeDialog]) + if (wtype == netatom[NetWMWindowTypeDialog]) { + c->iscentered = 1; c->isfloating = 1; + } } void |