commit f0233fe2a41e9e24325428cacce4e21d0f1ec1ac
parent f45357649014d4d96b32049a1e055288d56b64a7
Author: Ondrej Grover <ondrej.grover@gmail.com>
Date: Sat, 7 Jun 2014 11:40:29 +0200
new dwm patch: hide_vacant_tags
prevents displaying vacant tags on the bar
Diffstat:
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/dwm-6.1-hide_vacant_tags.diff b/dwm.suckless.org/patches/dwm-6.1-hide_vacant_tags.diff
@@ -0,0 +1,32 @@
+diff --git a/dwm.c b/dwm.c
+index ffc8864..161ec27 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -423,9 +423,15 @@ buttonpress(XEvent *e) {
+ }
+ if(ev->window == selmon->barwin) {
+ i = x = 0;
+- do
++ unsigned int occ = 0;
++ for(c = m->clients; c; c = c->next)
++ occ |= c->tags;
++ do {
++ /* do not reserve space for vacant tags */
++ if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
++ continue;
+ x += TEXTW(tags[i]);
+- while(ev->x >= x && ++i < LENGTH(tags));
++ } while(ev->x >= x && ++i < LENGTH(tags));
+ if(i < LENGTH(tags)) {
+ click = ClkTagBar;
+ arg.ui = 1 << i;
+@@ -703,6 +709,9 @@ drawbar(Monitor *m) {
+ }
+ x = 0;
+ for(i = 0; i < LENGTH(tags); i++) {
++ /* do not draw vacant tags */
++ if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
++ continue;
+ w = TEXTW(tags[i]);
+ drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
diff --git a/dwm.suckless.org/patches/hide_vacant_tags.md b/dwm.suckless.org/patches/hide_vacant_tags.md
@@ -0,0 +1,15 @@
+hide_vacant_tags
+================
+
+Description
+-----------
+
+This patch prevents dwm from drawing tags with no clients
+(i.e. vacant) on the bar. It also makes sure that pressing a tag on
+the bar behaves accordingly by not reserving reactive regions on the
+bar for vacant tags.
+
+Download
+--------
+
+* [dwm-6.1-hide_vacant_tags.diff](dwm-6.1-hide_vacant_tags.diff) (957b) (20140607)