[wiki] [sites] new dwm patch: hide_vacant_tags || Ondrej Grover

From: <git_AT_suckless.org>
Date: Sat, 07 Jun 2014 11:47:13 +0200

commit f0233fe2a41e9e24325428cacce4e21d0f1ec1ac
Author: Ondrej Grover <ondrej.grover_AT_gmail.com>
Date: Sat Jun 7 11:40:29 2014 +0200

    new dwm patch: hide_vacant_tags
    
    prevents displaying vacant tags on the bar

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
new file mode 100644
index 0000000..952db9c
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-6.1-hide_vacant_tags.diff
_AT_@ -0,0 +1,32 @@
+diff --git a/dwm.c b/dwm.c
+index ffc8864..161ec27 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -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;
+_AT_@ -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
new file mode 100644
index 0000000..ff9f4ad
--- /dev/null
+++ b/dwm.suckless.org/patches/hide_vacant_tags.md
_AT_@ -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)
Received on Sat Jun 07 2014 - 11:47:13 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:38:56 CEST