My coding style isn't great, but if you want something that works to try it and
see if
you actually like it in practice, attatched is the patch to draw.c
cheers, dave tweed
On Wed, Nov 22, 2006 at 01:13:10PM +0000, David Tweed wrote:
> Another personal hack is to have a dot (opposite corner to the
> "current clients tags" dot in tag bar) on the tags which displays
> if the tag has any clients tagged with it. This is partly useful to avoid
> having to
> search through all tags (rather than just non-empty ones)
> if I forget where something is, but it also
That's interesting, I think I adapt that ;)
--
Anselm R. Garbe >< http://suckless.org/~arg/ >< GPG key: 0D73F361
Send instant messages to your online friends http://uk.messenger.yahoo.com
--- dwm-2.2/draw.c 2006-11-21 08:41:15.000000000 +0000
+++ dwm-2.2.modified/draw.c 2006-11-21 15:14:02.000000000 +0000
@@ -20,7 +20,8 @@
}
static void
-drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
+drawtext(const char *text, unsigned long col[ColLast], Bool highlight,
+Bool highlight2) {
int x, y, w, h;
static char buf[256];
unsigned int len, olen;
@@ -69,6 +70,12 @@
r.width = r.height = (h + 2) / 4;
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
}
+ if(highlight2) {
+ r.width = r.height = (h+2)/4;
+ r.x = dc.x + dc.w -r.width - 2;
+ r.y = dc.y + dc.h -r.height- 2;
+ XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
+ }
}
/* extern */
@@ -82,21 +89,39 @@
drawstatus();
}
+static Bool occupiedTags[28];
+
+void
+figureTagsSet()
+{
+ Client *c;
+ int i;
+ for(i=0;i<ntags;++i){
+ occupiedTags[i]=False;
+ }
+ for(c=clients;c; c=c->next){
+ for(i=0;i<ntags;++i){
+ occupiedTags[i]=occupiedTags[i] || c->tags[i];
+ }
+ }
+}
+
void
drawstatus(void) {
int i, x;
+ figureTagsSet();
dc.x = dc.y = 0;
for(i = 0; i < ntags; i++) {
dc.w = textw(tags[i]);
if(seltag[i])
- drawtext(tags[i], dc.sel, sel && sel->tags[i]);
+ drawtext(tags[i], dc.sel, sel && sel->tags[i],occupiedTags[i]);
else
- drawtext(tags[i], dc.norm, sel && sel->tags[i]);
+ drawtext(tags[i], dc.norm, sel && sel->tags[i],occupiedTags[i]);
dc.x += dc.w;
}
dc.w = bmw;
- drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False);
+ drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False,False);
x = dc.x + dc.w;
dc.w = textw(stext);
dc.x = bx + bw - dc.w;
@@ -104,13 +129,13 @@
dc.x = x;
dc.w = bw - x;
}
- drawtext(stext, dc.status, False);
+ drawtext(stext, dc.status, False,False);
if((dc.w = dc.x - x) > bh) {
dc.x = x;
if(sel)
- drawtext(sel->name, dc.sel, False);
+ drawtext(sel->name, dc.sel, False,False);
else
- drawtext(NULL, dc.norm, False);
+ drawtext(NULL, dc.norm, False,False);
}
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
XSync(dpy, False);
@@ -128,7 +153,7 @@
XMapWindow(dpy, c->twin);
dc.x = dc.y = 0;
dc.w = c->tw;
- drawtext(c->name, dc.norm, False);
+ drawtext(c->name, dc.norm, False,False);
XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0);
XSync(dpy, False);
}