[wiki] [sites] dwm: new version of fancybar patch || Jochen Sprickerhof

From: <git_AT_suckless.org>
Date: Mon, 05 Jan 2015 09:42:15 +0100

commit 888f6f463a3726c472d80c625c0cb60daa9da876
Author: Jochen Sprickerhof <git_AT_jochen.sprickerhof.de>
Date: Mon Jan 5 09:41:17 2015 +0100

    dwm: new version of fancybar patch

diff --git a/dwm.suckless.org/patches/dwm-35db6d8-fancybar.diff b/dwm.suckless.org/patches/dwm-35db6d8-fancybar.diff
new file mode 100644
index 0000000..6c74209
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-35db6d8-fancybar.diff
_AT_@ -0,0 +1,69 @@
+diff --git a/dwm.c b/dwm.c
+index f896170..3da4cf2 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -692,11 +692,13 @@ dirtomon(int dir) {
+
+ void
+ drawbar(Monitor *m) {
+- int x, xx, w;
+- unsigned int i, occ = 0, urg = 0;
++ int x, xx, w, tw, mw;
++ unsigned int i, occ = 0, urg = 0, n = 0, extra = 0;
+ Client *c;
+
+ for(c = m->clients; c; c = c->next) {
++ if(ISVISIBLE(c))
++ n++;
+ occ |= c->tags;
+ if(c->isurgent)
+ urg |= c->tags;
+_AT_@ -728,15 +730,40 @@ drawbar(Monitor *m) {
+ x = m->ww;
+ if((w = x - xx) > bh) {
+ x = xx;
+- if(m->sel) {
+- drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
+- drw_text(drw, x, 0, w, bh, m->sel->name, 0);
+- drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0);
+- }
+- else {
+- drw_setscheme(drw, &scheme[SchemeNorm]);
+- drw_text(drw, x, 0, w, bh, NULL, 0);
++ if(n > 0) {
++ tw = m->sel->name ? TEXTW(m->sel->name) : 0;
++ mw = (tw >= w || n == 1) ? 0 : (w - tw) / (n - 1);
++
++ i = 0;
++ for(c = m->clients; c; c = c->next) {
++ if(!ISVISIBLE(c) || c == m->sel)
++ continue;
++ tw = TEXTW(c->name);
++ if(tw < mw)
++ extra += (mw - tw);
++ else
++ i++;
++ }
++ if(i > 0)
++ mw += extra / i;
++
++ for(c = m->clients; c; c = c->next) {
++ if(!ISVISIBLE(c))
++ continue;
++ xx = x + w;
++ tw = TEXTW(c->name);
++ w = MIN(m->sel == c ? w : mw, tw);
++
++ drw_setscheme(drw, m->sel == c ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
++ drw_text(drw, x, 0, w, bh, c->name, 0);
++ drw_rect(drw, x, 0, w, bh, c->isfixed, c->isfloating, 0);
++
++ x += w;
++ w = xx - x;
++ }
+ }
++ drw_setscheme(drw, &scheme[SchemeNorm]);
++ drw_text(drw, x, 0, w, bh, NULL, 0);
+ }
+ drw_map(drw, m->barwin, 0, 0, m->ww, bh);
+ }
diff --git a/dwm.suckless.org/patches/fancybar.md b/dwm.suckless.org/patches/fancybar.md
index 115837b..cb63c67 100644
--- a/dwm.suckless.org/patches/fancybar.md
+++ b/dwm.suckless.org/patches/fancybar.md
_AT_@ -15,10 +15,12 @@ fit, they're cropped. The title of the selected window is inverted.
  * [fancybar-5.6.1.diff](historical/fancybar-5.6.1.diff) (dwm 5.6.1) (20090824)
  * [fancybar-r1496.diff](fancybar-r1496.diff) (dwm 5.7) (20090922)
  * [fancybar-c794a9f5ae5e.patch](fancybar-c794a9f5ae5e.patch) (20120708)
+ * [dwm-35db6d8-fancybar.diff](dwm-35db6d8-fancybar.diff) (20150105)
 
 ## Author
 
  * Mate Nagy - <mnagy_AT_port70.net>
+ * Jochen Sprickerhof - project _AT_ firstname . lastname . de
 
 This patch was inspired by the decorated tabbed layout of Xmonad.
 
Received on Mon Jan 05 2015 - 09:42:15 CET

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:40:01 CEST