geom indicator and layout indicator is only displayed if there are several geoms/layouts

master
Anselm R Garbe 2008-03-24 13:33:32 +00:00
parent 2c2063bc75
commit a6a216f28c
2 changed files with 15 additions and 12 deletions

View File

@ -15,10 +15,7 @@ const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
Rule rules[] = { Rule rules[] = {
/* class instance title tags ref isfloating */ /* class instance title tags ref isfloating */
{ NULL, NULL, "Firefox", tags[8], False }, { "Gimp", NULL, NULL, NULL, True },
{ NULL, NULL, "Gimp", NULL, True },
{ NULL, NULL, "MPlayer", NULL, True },
{ NULL, NULL, "Acroread", NULL, True },
}; };
/* geometries, s{x,y,w,h} and bh are already initualized here */ /* geometries, s{x,y,w,h} and bh are already initualized here */

22
dwm.c
View File

@ -517,9 +517,11 @@ drawbar(void) {
Client *c; Client *c;
dc.x = 0; dc.x = 0;
dc.w = bgw; if(bgw > 0) {
drawtext(geom->symbol, dc.norm, False); dc.w = bgw;
dc.x += bgw; drawtext(geom->symbol, dc.norm, False);
dc.x += bgw;
}
for(c = stack; c && !isvisible(c); c = c->snext); for(c = stack; c && !isvisible(c); c = c->snext);
for(i = 0; i < LENGTH(tags); i++) { for(i = 0; i < LENGTH(tags); i++) {
dc.w = textw(tags[i]); dc.w = textw(tags[i]);
@ -533,9 +535,13 @@ drawbar(void) {
} }
dc.x += dc.w; dc.x += dc.w;
} }
dc.w = blw; if(blw > 0) {
drawtext(lt->symbol, dc.norm, False); dc.w = blw;
x = dc.x + dc.w; drawtext(lt->symbol, dc.norm, False);
x = dc.x + dc.w;
}
else
x = dc.x;
dc.w = textw(stext); dc.w = textw(stext);
dc.x = bw - dc.w; dc.x = bw - dc.w;
if(dc.x < x) { if(dc.x < x) {
@ -1502,12 +1508,12 @@ setup(void) {
lt = &layouts[0]; lt = &layouts[0];
/* init bar */ /* init bar */
for(blw = i = 0; i < LENGTH(layouts); i++) { for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) {
w = textw(layouts[i].symbol); w = textw(layouts[i].symbol);
if(w > blw) if(w > blw)
blw = w; blw = w;
} }
for(bgw = i = 0; i < LENGTH(geoms); i++) { for(bgw = i = 0; LENGTH(geoms) > 1 && i < LENGTH(geoms); i++) {
w = textw(geoms[i].symbol); w = textw(geoms[i].symbol);
if(w > bgw) if(w > bgw)
bgw = w; bgw = w;