- shows all windownames in the statusbar (this is nice for the maximized layout, as you wouldnt see there are multiple windows on that tag otherweise). that stuff is a little bit messy, id like to see suggestions how to make that better. it uses a defined maximum length for the title, and if the length of all windownames gets too long, the title will not be drawn.

IMHO, it looks like most of the messiness is due to the 1px separators: the code is much cleaner without them. The version below omits them, and divides the available space if the length of all windownames gets too long.

If you really like the 1px separators, maybe you should draw a big box before anything else, and add
        dc.x++
wherever you want one?

void
drawbar(void) {
        int i, x;
        Client *c;

        dc.x = 0;
        for(i = 0; i < LENGTH(tags); i++) {
                dc.w = TEXTW(tags[i]);
                if(tagset[seltags] & 1 << i)
                        drawtext(tags[i], dc.norm, True);
                else if(isurgent(i))
                        drawtext(tags[i], dc.sel, False);
                else
                        continue;
                dc.x += dc.w;
        }
        if(blw > 0) {
                dc.w = blw;
                drawtext(lt[sellt]->symbol, dc.norm, issaved());
                x = dc.x + dc.w;
        }
        else
                x = dc.x;
        dc.w = TEXTW(stext);
        dc.x = ww - dc.w;
        if(dc.x < x) {
                dc.x = x;
                dc.w = ww - x;
        }
        drawtext(stext, dc.norm, False);

        if((dc.w = dc.x - x) > bh) {
                int nvis = 0;
                int cw   = 0;
                int w;

                dc.w = dc.x - x;
                dc.x = x;
                drawtext(NULL, dc.norm, False);
                w = dc.w;

                /* get the number of visible clients */
                for(c = clients; c; c = c->next) {
                        if(ISVISIBLE(c)) {
                                nvis++;
                                cw += TEXTW(c->name);
                        }
                }
                for(c = clients; c; c = c->next) {
                        if(!ISVISIBLE(c))
                                continue;
                        dc.w = (cw > w) ? (w / nvis) : TEXTW(c->name);
                        drawtext(c->name, dc.norm, sel == c);
                        dc.x += dc.w;
                }
        }
        XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, ww, bh, 0, 0);
        XSync(dpy, False);
}


Reply via email to