|
@@ -111,7 +111,7 @@ struct Client {
|
|
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
|
|
int bw, oldbw;
|
|
|
unsigned int tags;
|
|
|
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
|
|
+ int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
|
|
Client *next;
|
|
|
Client *snext;
|
|
|
Monitor *mon;
|
|
@@ -161,6 +161,7 @@ typedef struct {
|
|
|
const char *instance;
|
|
|
const char *title;
|
|
|
unsigned int tags;
|
|
|
+ int iscentered;
|
|
|
int isfloating;
|
|
|
int monitor;
|
|
|
} Rule;
|
|
@@ -337,6 +338,7 @@ applyrules(Client *c)
|
|
|
XClassHint ch = { NULL, NULL };
|
|
|
|
|
|
/* rule matching */
|
|
|
+ c->iscentered = 0;
|
|
|
c->isfloating = 0;
|
|
|
c->tags = 0;
|
|
|
XGetClassHint(dpy, c->win, &ch);
|
|
@@ -349,6 +351,7 @@ applyrules(Client *c)
|
|
|
&& (!r->class || strstr(class, r->class))
|
|
|
&& (!r->instance || strstr(instance, r->instance)))
|
|
|
{
|
|
|
+ c->iscentered = r->iscentered;
|
|
|
c->isfloating = r->isfloating;
|
|
|
c->tags |= r->tags;
|
|
|
for (m = mons; m && m->num != r->monitor; m = m->next);
|
|
@@ -1644,6 +1647,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;
|
|
|
+ }
|
|
|
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
|
|
|
grabbuttons(c, 0);
|
|
|
if (!c->isfloating)
|
|
@@ -2864,8 +2871,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
|