added a similiar patch to Daves solution to indicate if there are clients with a specific tag
78f4b517
1 file(s) · +24 −8
| 8 | 8 | ||
| 9 | 9 | /* static */ |
|
| 10 | 10 | ||
| 11 | + | static Bool |
|
| 12 | + | isoccupied(unsigned int t) |
|
| 13 | + | { |
|
| 14 | + | Client *c; |
|
| 15 | + | for(c = clients; c; c = c->next) |
|
| 16 | + | if(c->tags[t]) |
|
| 17 | + | return True; |
|
| 18 | + | return False; |
|
| 19 | + | } |
|
| 20 | + | ||
| 11 | 21 | static unsigned int |
|
| 12 | 22 | textnw(const char *text, unsigned int len) { |
|
| 13 | 23 | XRectangle r; |
|
| 20 | 30 | } |
|
| 21 | 31 | ||
| 22 | 32 | static void |
|
| 23 | - | drawtext(const char *text, unsigned long col[ColLast], Bool highlight) { |
|
| 33 | + | drawtext(const char *text, unsigned long col[ColLast], Bool ldot, Bool rdot) { |
|
| 24 | 34 | int x, y, w, h; |
|
| 25 | 35 | static char buf[256]; |
|
| 26 | 36 | unsigned int len, olen; |
|
| 63 | 73 | XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv); |
|
| 64 | 74 | XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
|
| 65 | 75 | } |
|
| 66 | - | if(highlight) { |
|
| 76 | + | if(ldot) { |
|
| 67 | 77 | r.x = dc.x + 2; |
|
| 68 | 78 | r.y = dc.y + 2; |
|
| 69 | 79 | r.width = r.height = (h + 2) / 4; |
|
| 70 | 80 | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
|
| 71 | 81 | } |
|
| 82 | + | if(rdot) { |
|
| 83 | + | r.width = r.height = (h + 2) / 4; |
|
| 84 | + | r.x = dc.x + dc.w - r.width - 2; |
|
| 85 | + | r.y = dc.y + dc.h - r.height - 2; |
|
| 86 | + | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
|
| 87 | + | } |
|
| 72 | 88 | } |
|
| 73 | 89 | ||
| 74 | 90 | /* extern */ |
|
| 90 | 106 | for(i = 0; i < ntags; i++) { |
|
| 91 | 107 | dc.w = textw(tags[i]); |
|
| 92 | 108 | if(seltag[i]) |
|
| 93 | - | drawtext(tags[i], dc.sel, sel && sel->tags[i]); |
|
| 109 | + | drawtext(tags[i], dc.sel, sel && sel->tags[i], isoccupied(i)); |
|
| 94 | 110 | else |
|
| 95 | - | drawtext(tags[i], dc.norm, sel && sel->tags[i]); |
|
| 111 | + | drawtext(tags[i], dc.norm, sel && sel->tags[i], isoccupied(i)); |
|
| 96 | 112 | dc.x += dc.w; |
|
| 97 | 113 | } |
|
| 98 | 114 | dc.w = bmw; |
|
| 99 | - | drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False); |
|
| 115 | + | drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False, False); |
|
| 100 | 116 | x = dc.x + dc.w; |
|
| 101 | 117 | dc.w = textw(stext); |
|
| 102 | 118 | dc.x = bw - dc.w; |
|
| 104 | 120 | dc.x = x; |
|
| 105 | 121 | dc.w = bw - x; |
|
| 106 | 122 | } |
|
| 107 | - | drawtext(stext, dc.status, False); |
|
| 123 | + | drawtext(stext, dc.status, False, False); |
|
| 108 | 124 | if((dc.w = dc.x - x) > bh) { |
|
| 109 | 125 | dc.x = x; |
|
| 110 | - | drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False); |
|
| 126 | + | drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False, False); |
|
| 111 | 127 | } |
|
| 112 | 128 | XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); |
|
| 113 | 129 | XSync(dpy, False); |
|
| 125 | 141 | XMapWindow(dpy, c->twin); |
|
| 126 | 142 | dc.x = dc.y = 0; |
|
| 127 | 143 | dc.w = c->tw; |
|
| 128 | - | drawtext(c->name, dc.norm, False); |
|
| 144 | + | drawtext(c->name, dc.norm, False,False); |
|
| 129 | 145 | XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); |
|
| 130 | 146 | XSync(dpy, False); |
|
| 131 | 147 | } |
|