[wiki] [sites] [dwm][fancybar] Update patch || Jochen Sprickerhof
commit 229e76a9264bed47cd5e281a3eee5abfeab397d4
Author: Jochen Sprickerhof <git_AT_jochen.sprickerhof.de>
Date: Mon Nov 9 21:40:39 2015 +0100
[dwm][fancybar] Update patch
diff --git a/dwm.suckless.org/patches/dwm-35db6d8-fancybar.diff b/dwm.suckless.org/patches/dwm-35db6d8-fancybar.diff
deleted file mode 100644
index 6c74209..0000000
--- a/dwm.suckless.org/patches/dwm-35db6d8-fancybar.diff
+++ /dev/null
_AT_@ -1,69 +0,0 @@
-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/dwm-6.1-fancybar.diff b/dwm.suckless.org/patches/dwm-6.1-fancybar.diff
new file mode 100644
index 0000000..d1cc431
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-6.1-fancybar.diff
_AT_@ -0,0 +1,70 @@
+diff --git a/dwm.c b/dwm.c
+index 0362114..b74e787 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -704,13 +704,15 @@ dirtomon(int dir)
+ void
+ drawbar(Monitor *m)
+ {
+- int x, xx, w, dx;
+- unsigned int i, occ = 0, urg = 0;
++ int x, xx, w, dx, tw, mw;
++ unsigned int i, occ = 0, urg = 0, n = 0, extra = 0;
+ Client *c;
+
+ dx = (drw->fonts[0]->ascent + drw->fonts[0]->descent + 2) / 4;
+
+ for (c = m->clients; c; c = c->next) {
++ if (ISVISIBLE(c))
++ n++;
+ occ |= c->tags;
+ if (c->isurgent)
+ urg |= c->tags;
+_AT_@ -741,14 +743,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 + 1, 1, dx, dx, m->sel->isfixed, m->sel->isfloating, 0);
+- } else {
+- drw_setscheme(drw, &scheme[SchemeNorm]);
+- drw_rect(drw, x, 0, w, bh, 1, 0, 1);
++ 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 + 1, 1, dx, dx, c->isfixed, c->isfloating, 0);
++
++ x += w;
++ w = xx - x;
++ }
+ }
++ drw_setscheme(drw, &scheme[SchemeNorm]);
++ drw_rect(drw, x, 0, w, bh, 1, 0, 1);
+ }
+ drw_map(drw, m->barwin, 0, 0, m->ww, bh);
+ }
diff --git a/dwm.suckless.org/patches/fancybar-c794a9f5ae5e.patch b/dwm.suckless.org/patches/fancybar-c794a9f5ae5e.patch
deleted file mode 100644
index dc4da6e..0000000
--- a/dwm.suckless.org/patches/fancybar-c794a9f5ae5e.patch
+++ /dev/null
_AT_@ -1,124 +0,0 @@
---- dwm.c.orig 2012-09-30 16:19:00.251353990 -0400
-+++ dwm.c 2012-09-30 16:18:06.436026937 -0400
-_AT_@ -179,6 +179,7 @@
- static Monitor *dirtomon(int dir);
- static void drawbar(Monitor *m);
- static void drawbars(void);
-+static void drawline(unsigned long col[ColLast]);
- static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
- static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
- static void enternotify(XEvent *e);
-_AT_@ -721,12 +722,15 @@
-
- void
- drawbar(Monitor *m) {
-- int x;
-- unsigned int i, occ = 0, urg = 0;
-+ int x, ow, mw = 0, extra, tw;
-+ unsigned int i, n = 0, occ = 0, urg = 0;
- unsigned long *col;
-- Client *c;
-+ Client *c, *firstvis, *lastvis = NULL;
-+ DC seldc;
-
- for(c = m->clients; c; c = c->next) {
-+ if(ISVISIBLE(c))
-+ n++;
- occ |= c->tags;
- if(c->isurgent)
- urg |= c->tags;
-_AT_@ -755,16 +759,61 @@
- }
- else
- dc.x = m->ww;
-- if((dc.w = dc.x - x) > bh) {
-- dc.x = x;
-- if(m->sel) {
-- col = m == selmon ? dc.sel : dc.norm;
-- drawtext(m->sel->name, col, False);
-- drawsquare(m->sel->isfixed, m->sel->isfloating, False, col);
-+ for(c = m->clients; c && !ISVISIBLE(c); c = c->next);
-+ firstvis = c;
-+
-+ col = m == selmon ? dc.sel : dc.norm;
-+ dc.w = dc.x - x;
-+ dc.x = x;
-+
-+ if(n > 0) {
-+ mw = dc.w / n;
-+ extra = 0;
-+ seldc = dc;
-+ i = 0;
-+
-+ while(c) {
-+ lastvis = c;
-+ tw = TEXTW(c->name);
-+ if(tw < mw) extra += (mw - tw); else i++;
-+ for(c = c->next; c && !ISVISIBLE(c); c = c->next);
- }
-- else
-+
-+ if(i > 0) mw += extra / i;
-+
-+ c = firstvis;
-+ x = dc.x;
-+ }
-+
-+ while(dc.w > bh) {
-+ if(c) {
-+ ow = dc.w;
-+ tw = TEXTW(c->name);
-+ dc.w = MIN(ow, tw);
-+
-+ if(dc.w > mw) dc.w = mw;
-+ if(m->sel ==c) seldc = dc;
-+ if(c == lastvis) dc.w = ow;
-+
-+ drawtext(c->name, col, False);
-+ if(c != firstvis) drawline(col);
-+ drawsquare(c->isfixed, c->isfloating, False, col);
-+
-+ dc.x += dc.w;
-+ dc.w = ow - dc.w;
-+ for(c = c->next; c&& !ISVISIBLE(c); c = c->next);
-+ } else {
- drawtext(NULL, dc.norm, False);
-+ break;
-+ }
- }
-+
-+ if(m == selmon && m->sel && ISVISIBLE(m->sel)) {
-+ dc = seldc;
-+ drawtext(m->sel->name, col, True);
-+ drawsquare(m->sel->isfixed, m->sel->isfloating, True, col);
-+ }
-+
- XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0);
- XSync(dpy, False);
- }
-_AT_@ -778,6 +827,15 @@
- }
-
- void
-+drawline(unsigned long col[ColLast]) {
-+ XGCValues gcv;
-+
-+ gcv.foreground = col[ColFG];
-+ XChangeGC(dpy, dc.gc, GCForeground, &gcv);
-+ XDrawLine(dpy, dc.drawable, dc.gc, dc.x, dc.y, dc.x, dc.y + (dc.font.ascent + dc.font.descent + 2));
-+}
-+
-+void
- drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) {
- int x;
-
-_AT_@ -1327,8 +1385,7 @@
- }
- if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
- updatetitle(c);
-- if(c == c->mon->sel)
-- drawbar(c->mon);
-+ drawbar(c->mon);
- }
- if(ev->atom == netatom[NetWMWindowType])
- updatewindowtype(c);
diff --git a/dwm.suckless.org/patches/fancybar-r1496.diff b/dwm.suckless.org/patches/fancybar-r1496.diff
deleted file mode 100644
index 7f09e88..0000000
--- a/dwm.suckless.org/patches/fancybar-r1496.diff
+++ /dev/null
_AT_@ -1,126 +0,0 @@
-diff -r de4a2998e1f5 dwm.c
---- a/dwm.c Tue Sep 22 09:53:11 2009 +0100
-+++ b/dwm.c Tue Sep 22 12:32:15 2009 +0200
-_AT_@ -171,6 +171,7 @@
- static Monitor *dirtomon(int dir);
- static void drawbar(Monitor *m);
- static void drawbars(void);
-+static void drawvline(unsigned long col[ColLast]);
- static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
- static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
- static void enternotify(XEvent *e);
-_AT_@ -668,12 +669,15 @@
-
- void
- drawbar(Monitor *m) {
-- int x;
-- unsigned int i, occ = 0, urg = 0;
-+ int x, ow, mw = 0, extra, tw;
-+ unsigned int i, n = 0, occ = 0, urg = 0;
- unsigned long *col;
-- Client *c;
-+ Client *c, *firstvis, *lastvis = NULL;
-+ DC seldc;
-
- for(c = m->clients; c; c = c->next) {
-+ if(ISVISIBLE(c))
-+ n++;
- occ |= c->tags;
- if(c->isurgent)
- urg |= c->tags;
-_AT_@ -702,16 +706,62 @@
- }
- else
- dc.x = m->ww;
-- if((dc.w = dc.x - x) > bh) {
-- dc.x = x;
-- if(m->sel) {
-- col = m == selmon ? dc.sel : dc.norm;
-- drawtext(m->sel->name, col, False);
-- drawsquare(m->sel->isfixed, m->sel->isfloating, False, col);
-+
-+ for(c = m->clients; c && !ISVISIBLE(c); c = c->next);
-+ firstvis = c;
-+
-+ col = m == selmon ? dc.sel : dc.norm;
-+ dc.w = dc.x - x;
-+ dc.x = x;
-+
-+ if(n > 0) {
-+ mw = dc.w / n;
-+ extra = 0;
-+ seldc = dc;
-+ i = 0;
-+
-+ while(c) {
-+ lastvis = c;
-+ tw = TEXTW(c->name);
-+ if(tw < mw) extra += (mw - tw); else i++;
-+ for(c = c->next; c && !ISVISIBLE(c); c = c->next);
- }
-- else
-+
-+ if(i > 0) mw += extra / i;
-+
-+ c = firstvis;
-+ x = dc.x;
-+ }
-+
-+ while(dc.w > bh) {
-+ if(c) {
-+ ow = dc.w;
-+ tw = TEXTW(c->name);
-+ dc.w = MIN(ow, tw);
-+
-+ if(dc.w > mw) dc.w = mw;
-+ if(m->sel == c) seldc = dc;
-+ if(c == lastvis) dc.w = ow;
-+
-+ drawtext(c->name, col, False);
-+ if(c != firstvis) drawvline(col);
-+ drawsquare(c->isfixed, c->isfloating, False, col);
-+
-+ dc.x += dc.w;
-+ dc.w = ow - dc.w;
-+ for(c = c->next; c && !ISVISIBLE(c); c = c->next);
-+ } else {
- drawtext(NULL, dc.norm, False);
-+ break;
-+ }
- }
-+
-+ if(m == selmon && m->sel && ISVISIBLE(m->sel)) {
-+ dc = seldc;
-+ drawtext(m->sel->name, col, True);
-+ drawsquare(m->sel->isfixed, m->sel->isfloating, True, col);
-+ }
-+
- XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0);
- XSync(dpy, False);
- }
-_AT_@ -725,6 +775,15 @@
- }
-
- void
-+drawvline(unsigned long col[ColLast]) {
-+ XGCValues gcv;
-+
-+ gcv.foreground = col[ColFG];
-+ XChangeGC(dpy, dc.gc, GCForeground, &gcv);
-+ XDrawLine(dpy, dc.drawable, dc.gc, dc.x, dc.y, dc.x, dc.y + (dc.font.ascent + dc.font.descent + 2));
-+}
-+
-+void
- drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) {
- int x;
- XGCValues gcv;
-_AT_@ -1274,8 +1333,7 @@
- }
- if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
- updatetitle(c);
-- if(c == c->mon->sel)
-- drawbar(c->mon);
-+ drawbar(c->mon);
- }
- }
- }
diff --git a/dwm.suckless.org/patches/fancybar.md b/dwm.suckless.org/patches/fancybar.md
index b79c022..7aff206 100644
--- a/dwm.suckless.org/patches/fancybar.md
+++ b/dwm.suckless.org/patches/fancybar.md
_AT_@ -13,9 +13,7 @@ fit, they're cropped. The title of the selected window is inverted.
## Download
* [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)
+ * [dwm-6.1-fancybar.diff](dwm-6.1-fancybar.diff) (20151109)
## Author
Received on Mon Nov 09 2015 - 21:43:51 CET
This archive was generated by hypermail 2.3.0
: Mon Nov 09 2015 - 21:48:11 CET