119 const char *symbol; |
119 const char *symbol; |
120 void (*arrange)(Monitor *); |
120 void (*arrange)(Monitor *); |
121 } Layout; |
121 } Layout; |
122 |
122 |
123 struct Monitor { |
123 struct Monitor { |
|
124 const char *ltsymbol; |
124 float mfact; |
125 float mfact; |
125 int num; |
126 int num; |
126 int by; /* bar geometry */ |
127 int by; /* bar geometry */ |
127 int mx, my, mw, mh; /* screen size */ |
128 int mx, my, mw, mh; /* screen size */ |
128 int wx, wy, ww, wh; /* window area */ |
129 int wx, wy, ww, wh; /* window area */ |
236 static int xerrorstart(Display *dpy, XErrorEvent *ee); |
237 static int xerrorstart(Display *dpy, XErrorEvent *ee); |
237 static void zoom(const Arg *arg); |
238 static void zoom(const Arg *arg); |
238 |
239 |
239 /* variables */ |
240 /* variables */ |
240 static const char broken[] = "broken"; |
241 static const char broken[] = "broken"; |
241 static char stext[256], ntext[8]; |
242 static char stext[256]; |
242 static int screen; |
243 static int screen; |
243 static int sw, sh; /* X display screen geometry width, height */ |
244 static int sw, sh; /* X display screen geometry width, height */ |
244 static int bh, blw = 0; /* bar geometry */ |
245 static int bh, blw = 0; /* bar geometry */ |
245 static int (*xerrorxlib)(Display *, XErrorEvent *); |
246 static int (*xerrorxlib)(Display *, XErrorEvent *); |
246 static unsigned int numlockmask = 0; |
247 static unsigned int numlockmask = 0; |
667 drawtext(tags[i], col, urg & 1 << i); |
667 drawtext(tags[i], col, urg & 1 << i); |
668 drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, |
668 drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, |
669 occ & 1 << i, urg & 1 << i, col); |
669 occ & 1 << i, urg & 1 << i, col); |
670 dc.x += dc.w; |
670 dc.x += dc.w; |
671 } |
671 } |
672 if(blw > 0) { |
672 dc.w = blw = TEXTW(m->ltsymbol); |
673 dc.w = blw; |
673 drawtext(m->ltsymbol, dc.norm, False); |
674 drawtext(m->lt[m->sellt]->symbol, dc.norm, False); |
674 dc.x += dc.w; |
675 dc.x += dc.w; |
675 x = dc.x; |
676 } |
|
677 snprintf(ntext, sizeof ntext, "%u", n); |
|
678 dc.w = TEXTW(ntext); |
|
679 drawtext(ntext, dc.norm, False); |
|
680 x = (dc.x += dc.w); |
|
681 if(m == selmon) { /* status is only drawn on selected monitor */ |
676 if(m == selmon) { /* status is only drawn on selected monitor */ |
682 dc.w = TEXTW(stext); |
677 dc.w = TEXTW(stext); |
683 dc.x = m->ww - dc.w; |
678 dc.x = m->ww - dc.w; |
684 if(dc.x < x) { |
679 if(dc.x < x) { |
685 dc.x = x; |
680 dc.x = x; |
1135 manage(ev->window, &wa); |
1130 manage(ev->window, &wa); |
1136 } |
1131 } |
1137 |
1132 |
1138 void |
1133 void |
1139 monocle(Monitor *m) { |
1134 monocle(Monitor *m) { |
|
1135 static char ntext[8]; |
|
1136 unsigned int n = 0; |
1140 Client *c; |
1137 Client *c; |
1141 |
1138 |
|
1139 for(c = m->clients; c; c = c->next) |
|
1140 if(ISVISIBLE(c)) |
|
1141 n++; |
|
1142 if(n > 0) { /* override layout symbol */ |
|
1143 snprintf(ntext, sizeof ntext, "[%d]", n); |
|
1144 m->ltsymbol = ntext; |
|
1145 } |
1142 for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) |
1146 for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) |
1143 resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False); |
1147 resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False); |
1144 } |
1148 } |
1145 |
1149 |
1146 void |
1150 void |
1467 dc.gc = XCreateGC(dpy, root, 0, NULL); |
1469 dc.gc = XCreateGC(dpy, root, 0, NULL); |
1468 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
1470 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
1469 if(!dc.font.set) |
1471 if(!dc.font.set) |
1470 XSetFont(dpy, dc.gc, dc.font.xfont->fid); |
1472 XSetFont(dpy, dc.gc, dc.font.xfont->fid); |
1471 /* init bars */ |
1473 /* init bars */ |
1472 for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) { |
|
1473 w = TEXTW(layouts[i].symbol); |
|
1474 blw = MAX(blw, w); |
|
1475 } |
|
1476 updatebars(); |
1474 updatebars(); |
1477 updatestatus(); |
1475 updatestatus(); |
1478 /* EWMH support per view */ |
1476 /* EWMH support per view */ |
1479 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
1477 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
1480 PropModeReplace, (unsigned char *) netatom, NetLast); |
1478 PropModeReplace, (unsigned char *) netatom, NetLast); |
1750 m->mfact = mfact; |
1748 m->mfact = mfact; |
1751 m->showbar = showbar; |
1749 m->showbar = showbar; |
1752 m->topbar = topbar; |
1750 m->topbar = topbar; |
1753 m->lt[0] = &layouts[0]; |
1751 m->lt[0] = &layouts[0]; |
1754 m->lt[1] = &layouts[1 % LENGTH(layouts)]; |
1752 m->lt[1] = &layouts[1 % LENGTH(layouts)]; |
|
1753 m->ltsymbol = layouts[0].symbol; |
1755 updatebarpos(m); |
1754 updatebarpos(m); |
1756 } |
1755 } |
1757 /* reassign left over clients of disappeared monitors */ |
1756 /* reassign left over clients of disappeared monitors */ |
1758 for(tm = mons; tm; tm = tm->next) |
1757 for(tm = mons; tm; tm = tm->next) |
1759 while(tm->clients) { |
1758 while(tm->clients) { |