} Layout;
struct Monitor {
- int screen_number;
float mfact;
+ int num;
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
const char *title;
unsigned int tags;
Bool isfloating;
+ int monitor;
} Rule;
/* function declarations */
static void zoom(const Arg *arg);
/* variables */
+static const char broken[] = "broken";
static char stext[256], ntext[8];
static int screen;
-static int sw, sh; /* X display screen geometry x, y, width, height */
+static int sw, sh; /* X display screen geometry width, height */
static int bh, blw = 0; /* bar geometry */
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
/* function implementations */
void
applyrules(Client *c) {
+ const char *class, *instance;
unsigned int i;
const Rule *r;
+ Monitor *m;
XClassHint ch = { 0 };
/* rule matching */
c->isfloating = c->tags = 0;
if(XGetClassHint(dpy, c->win, &ch)) {
+ class = ch.res_class ? ch.res_class : broken;
+ instance = ch.res_name ? ch.res_name : broken;
for(i = 0; i < LENGTH(rules); i++) {
r = &rules[i];
if((!r->title || strstr(c->name, r->title))
- && (!r->class || (ch.res_class && strstr(ch.res_class, r->class)))
- && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance))))
+ && (!r->class || strstr(class, r->class))
+ && (!r->instance || strstr(instance, r->instance)))
{
c->isfloating = r->isfloating;
c->tags |= r->tags;
+ for(m = mons; m && m->num != r->monitor; m = m->next);
+ if(m)
+ c->mon = m;
}
}
if(ch.res_class)
die("fatal: could not malloc() %u bytes\n", sizeof(Client));
*c = cz;
c->win = w;
+ updatetitle(c);
if(XGetTransientForHint(dpy, w, &trans))
t = wintoclient(trans);
if(t) {
updatesizehints(c);
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, False);
- updatetitle(c);
if(!c->isfloating)
c->isfloating = trans != None || c->isfixed;
if(c->isfloating)
updategeom(void) {
int i, n = 1;
Client *c;
- Monitor *newmons = NULL, *m, *tm;
+ Monitor *newmons = NULL, *m = NULL, *tm;
#ifdef XINERAMA
XineramaScreenInfo *info = NULL;
#ifdef XINERAMA
if(XineramaIsActive(dpy)) {
for(i = 0, m = newmons; m; m = m->next, i++) {
- m->screen_number = info[i].screen_number;
+ m->num = info[i].screen_number;
m->mx = m->wx = info[i].x_org;
m->my = m->wy = info[i].y_org;
m->mw = m->ww = info[i].width;
#endif /* XINERAMA */
/* default monitor setup */
{
- m->screen_number = 0;
+ m->num = 0;
m->mx = m->wx = 0;
m->my = m->wy = 0;
m->mw = m->ww = sw;
updatetitle(Client *c) {
if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
+ if(c->name[0] == '\0') /* hack to mark broken clients */
+ strcpy(c->name, broken);
}
void