Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-fancybar-6.1.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-fancybar-6.1.diff (1822B)
---
1 diff --git a/dwm.c b/dwm.c
2 index 0362114..b74e787 100644
3 --- a/dwm.c
4 +++ b/dwm.c
5 @@ -704,13 +704,15 @@ dirtomon(int dir)
6 void
7 drawbar(Monitor *m)
8 {
9 - int x, xx, w, dx;
10 - unsigned int i, occ = 0, urg = 0;
11 + int x, xx, w, dx, tw, mw;
12 + unsigned int i, occ = 0, urg = 0, n = 0, extra = 0;
13 Client *c;
14
15 dx = (drw->fonts[0]->ascent + drw->fonts[0]->descent + 2) / 4;
16
17 for (c = m->clients; c; c = c->next) {
18 + if (ISVISIBLE(c))
19 + n++;
20 occ |= c->tags;
21 if (c->isurgent)
22 urg |= c->tags;
23 @@ -741,14 +743,40 @@ drawbar(Monitor *m)
24 x = m->ww;
25 if ((w = x - xx) > bh) {
26 x = xx;
27 - if (m->sel) {
28 - drw_setscheme(drw, m == selmon ? &scheme[Scheme…
29 - drw_text(drw, x, 0, w, bh, m->sel->name, 0);
30 - drw_rect(drw, x + 1, 1, dx, dx, m->sel->isfixed…
31 - } else {
32 - drw_setscheme(drw, &scheme[SchemeNorm]);
33 - drw_rect(drw, x, 0, w, bh, 1, 0, 1);
34 + if (n > 0) {
35 + tw = m->sel->name ? TEXTW(m->sel->name) : 0;
36 + mw = (tw >= w || n == 1) ? 0 : (w - tw) / (n - …
37 +
38 + i = 0;
39 + for (c = m->clients; c; c = c->next) {
40 + if (!ISVISIBLE(c) || c == m->sel)
41 + continue;
42 + tw = TEXTW(c->name);
43 + if(tw < mw)
44 + extra += (mw - tw);
45 + else
46 + i++;
47 + }
48 + if (i > 0)
49 + mw += extra / i;
50 +
51 + for (c = m->clients; c; c = c->next) {
52 + if (!ISVISIBLE(c))
53 + continue;
54 + xx = x + w;
55 + tw = TEXTW(c->name);
56 + w = MIN(m->sel == c ? w : mw, tw);
57 +
58 + drw_setscheme(drw, m->sel == c ? &schem…
59 + drw_text(drw, x, 0, w, bh, c->name, 0);
60 + drw_rect(drw, x + 1, 1, dx, dx, c->isfi…
61 +
62 + x += w;
63 + w = xx - x;
64 + }
65 }
66 + drw_setscheme(drw, &scheme[SchemeNorm]);
67 + drw_rect(drw, x, 0, w, bh, 1, 0, 1);
68 }
69 drw_map(drw, m->barwin, 0, 0, m->ww, bh);
70 }
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.