mirror of
https://github.com/alrayyes/dwm.git
synced 2024-11-22 03:26:23 +00:00
added fancybar patch
This commit is contained in:
parent
7392262d12
commit
64aa1771db
2 changed files with 76 additions and 1 deletions
4
PKGBUILD
4
PKGBUILD
|
@ -22,6 +22,7 @@ _patches=(
|
|||
"https://dwm.suckless.org/patches/selfrestart/dwm-r1615-selfrestart.diff"
|
||||
"local-hide_vacant_tags-git-20160626-7af4d43.diff"
|
||||
"local-statuscolors-20181008-b69c870.diff"
|
||||
"local-fancybar-2019018-b69c870.diff"
|
||||
)
|
||||
|
||||
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
|
||||
|
@ -40,7 +41,8 @@ md5sums=('9929845ccdec4d2cc191f16210dd7f3d'
|
|||
'6055775113fd4dc06200bc6aaafb72fb'
|
||||
'aa3d5f3c45057a2a6ee73aede3fc218a'
|
||||
'd2781ac29048fc50e42e0f11e6cf7bce'
|
||||
'c5469c1457955a8447e05ec5118b3ce6')
|
||||
'c5469c1457955a8447e05ec5118b3ce6'
|
||||
'77e3bfab2270dde73caf4e1b14566386')
|
||||
|
||||
prepare() {
|
||||
cd $srcdir/$pkgname-$pkgver
|
||||
|
|
73
local-fancybar-2019018-b69c870.diff
Normal file
73
local-fancybar-2019018-b69c870.diff
Normal file
|
@ -0,0 +1,73 @@
|
|||
diff -up a/dwm.c b/dwm.c
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -822,10 +822,10 @@ dirtomon(int dir)
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
- int x, w, sw = 0, stw = 0;
|
||||
+ int x, w, sw = 0, stw = 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;
|
||||
char *ts = stext;
|
||||
char *tp = stext;
|
||||
int tx = 0;
|
||||
@@ -854,6 +854,8 @@ drawbar(Monitor *m)
|
||||
|
||||
resizebarwin(m);
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
+ if (ISVISIBLE(c))
|
||||
+ n++;
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
@@ -872,15 +874,39 @@ drawbar(Monitor *m)
|
||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
if ((w = m->ww - sw - stw - 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) + lrpad;
|
||||
+ 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 = MIN(m->sel == c ? w : mw, TEXTW(c->name));
|
||||
+
|
||||
+ drw_setscheme(drw, scheme[m->sel == c ? SchemeSel : SchemeNorm]);
|
||||
+ if (tw > 0) /* trap special handling of 0 in drw_text */
|
||||
+ 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 - stw, bh);
|
||||
}
|
Loading…
Reference in a new issue