commit 888f6f463a3726c472d80c625c0cb60daa9da876
parent e63ab33a0a8ac217f6607918f64eb9c6bdab1e0c
Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Mon, 5 Jan 2015 09:41:17 +0100
dwm: new version of fancybar patch
Diffstat:
2 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/dwm-35db6d8-fancybar.diff b/dwm.suckless.org/patches/dwm-35db6d8-fancybar.diff
@@ -0,0 +1,69 @@
+diff --git a/dwm.c b/dwm.c
+index f896170..3da4cf2 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -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;
+@@ -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
@@ -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@port70.net>
+ * Jochen Sprickerhof - project @ firstname . lastname . de
This patch was inspired by the decorated tabbed layout of Xmonad.