[wiki] [sites] [dwm][fancybar] update patch || Jochen Sprickerhof

From: <git_AT_suckless.org>
Date: Sun, 26 Jun 2016 20:40:27 +0200

commit 8ea2bd1239156c65d3c76d5237c4c871d0b0c04a
Author: Jochen Sprickerhof <git_AT_jochen.sprickerhof.de>
Date: Sun Jun 26 20:37:12 2016 +0200

    [dwm][fancybar] update patch

diff --git a/dwm.suckless.org/patches/dwm-fancybar-git-20160626-7af4d43.diff b/dwm.suckless.org/patches/dwm-fancybar-git-20160626-7af4d43.diff
new file mode 100644
index 0000000..eae60e4
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-fancybar-git-20160626-7af4d43.diff
_AT_@ -0,0 +1,73 @@
+diff --git a/dwm.c b/dwm.c
+index b2bc9bd..7552358 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -708,10 +708,10 @@ dirtomon(int dir)
+ void
+ drawbar(Monitor *m)
+ {
+- int x, w, sw = 0;
++ int x, w, sw = 0, tw, mw, ew = 0;
+ int boxs = drw->fonts->h / 9;
+ int boxw = drw->fonts->h / 6 + 2;
+- unsigned int i, occ = 0, urg = 0;
++ unsigned int i, occ = 0, urg = 0, n = 0;
+ Client *c;
+
+ /* draw status first so it can be overdrawn by tags later */
+_AT_@ -722,6 +722,8 @@ drawbar(Monitor *m)
+ }
+
+ for (c = m->clients; c; c = c->next) {
++ if (ISVISIBLE(c))
++ n++;
+ occ |= c->tags;
+ if (c->isurgent)
+ urg |= c->tags;
+_AT_@ -742,15 +744,38 @@ drawbar(Monitor *m)
+ x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
+
+ if ((w = m->ww - sw - x) > bh) {
+- if (m->sel) {
+- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
+- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
+- if (m->sel->isfloating)
+- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
+- } else {
+- drw_setscheme(drw, scheme[SchemeNorm]);
+- drw_rect(drw, x, 0, w, bh, 1, 1);
++ if (n > 0) {
++ tw = TEXTW(m->sel->name);
++ 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)
++ ew += (mw - tw);
++ else
++ i++;
++ }
++ if (i > 0)
++ mw += ew / i;
++
++ for (c = m->clients; c; c = c->next) {
++ if (!ISVISIBLE(c))
++ continue;
++ tw = m->sel == c ? TEXTW(c->name) : MIN(mw, TEXTW(c->name));
++
++ drw_setscheme(drw, scheme[m->sel == c ? SchemeSel : SchemeNorm]);
++ drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0);
++ if (c->isfloating)
++ drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0);
++ x += tw;
++ w -= tw;
++ }
+ }
++ drw_setscheme(drw, scheme[SchemeNorm]);
++ drw_rect(drw, x, 0, w, bh, 1, 1);
+ }
+ 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 7aff206..e13a924 100644
--- a/dwm.suckless.org/patches/fancybar.md
+++ b/dwm.suckless.org/patches/fancybar.md
_AT_@ -14,11 +14,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)
  * [dwm-6.1-fancybar.diff](dwm-6.1-fancybar.diff) (20151109)
+ * [dwm-fancybar-git-20160626-7af4d43.diff](dwm-fancybar-git-20160626-7af4d43.diff)
 
 ## Author
 
  * Mate Nagy - <mnagy_AT_port70.net>
- * Jochen Sprickerhof - project _AT_ firstname . lastname . de
+ * [Jochen Sprickerhof](mailto:project_AT_firstname.lastname.de) (rewrite)
 
 This patch was inspired by the decorated tabbed layout of Xmonad.
 
Received on Sun Jun 26 2016 - 20:40:27 CEST

This archive was generated by hypermail 2.3.0 : Sun Jun 26 2016 - 20:48:20 CEST