mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding fancybar patch
This commit is contained in:
parent
611460c6a6
commit
ec546d7995
@ -35,6 +35,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
- [autostart](https://dwm.suckless.org/patches/autostart/)
|
- [autostart](https://dwm.suckless.org/patches/autostart/)
|
||||||
- makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup
|
- makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup
|
||||||
|
|
||||||
|
- [fancybar](https://dwm.suckless.org/patches/fancybar/)
|
||||||
|
- shows the titles of all visible windows in the status bar
|
||||||
|
|
||||||
- [pertag](https://dwm.suckless.org/patches/pertag/)
|
- [pertag](https://dwm.suckless.org/patches/pertag/)
|
||||||
- adds nmaster, mfact, layouts and more per tag rather than per monitor
|
- adds nmaster, mfact, layouts and more per tag rather than per monitor
|
||||||
|
|
||||||
|
49
dwm.c
49
dwm.c
@ -825,6 +825,10 @@ void
|
|||||||
drawbar(Monitor *m)
|
drawbar(Monitor *m)
|
||||||
{
|
{
|
||||||
int x, w, sw = 0;
|
int x, w, sw = 0;
|
||||||
|
#if FANCYBAR_PATCH
|
||||||
|
int tw, mw, ew = 0;
|
||||||
|
unsigned int n = 0;
|
||||||
|
#endif // FANCYBAR_PATCH
|
||||||
#if SYSTRAY_PATCH
|
#if SYSTRAY_PATCH
|
||||||
int stw = 0;
|
int stw = 0;
|
||||||
#endif // SYSTRAY_PATCH
|
#endif // SYSTRAY_PATCH
|
||||||
@ -850,6 +854,10 @@ drawbar(Monitor *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (c = m->clients; c; c = c->next) {
|
for (c = m->clients; c; c = c->next) {
|
||||||
|
#if FANCYBAR_PATCH
|
||||||
|
if (ISVISIBLE(c))
|
||||||
|
n++;
|
||||||
|
#endif // FANCYBAR_PATCH
|
||||||
occ |= c->tags;
|
occ |= c->tags;
|
||||||
if (c->isurgent)
|
if (c->isurgent)
|
||||||
urg |= c->tags;
|
urg |= c->tags;
|
||||||
@ -870,10 +878,46 @@ drawbar(Monitor *m)
|
|||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
|
||||||
#if SYSTRAY_PATCH
|
#if SYSTRAY_PATCH
|
||||||
if ((w = m->ww - sw - stw - x) > bh) {
|
if ((w = m->ww - sw - stw - x) > bh)
|
||||||
#else
|
#else
|
||||||
if ((w = m->ww - sw - x) > bh) {
|
if ((w = m->ww - sw - x) > bh)
|
||||||
#endif // SYSTRAY_PATCH
|
#endif // SYSTRAY_PATCH
|
||||||
|
{
|
||||||
|
#if FANCYBAR_PATCH
|
||||||
|
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);
|
||||||
|
#else
|
||||||
if (m->sel) {
|
if (m->sel) {
|
||||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||||
@ -883,6 +927,7 @@ drawbar(Monitor *m)
|
|||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
}
|
}
|
||||||
|
#endif // FANCYBAR_PATCH
|
||||||
}
|
}
|
||||||
#if SYSTRAY_PATCH
|
#if SYSTRAY_PATCH
|
||||||
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
||||||
|
@ -44,6 +44,12 @@
|
|||||||
*/
|
*/
|
||||||
#define AUTOSTART_PATCH 0
|
#define AUTOSTART_PATCH 0
|
||||||
|
|
||||||
|
/* This patch shows the titles of all visible windows in the status bar
|
||||||
|
* (as opposed to showing only the selected one).
|
||||||
|
* https://dwm.suckless.org/patches/fancybar/
|
||||||
|
*/
|
||||||
|
#define FANCYBAR_PATCH 0
|
||||||
|
|
||||||
/* The pertag patch adds nmaster, mfacts and layouts per tag rather
|
/* The pertag patch adds nmaster, mfacts and layouts per tag rather
|
||||||
* than per monitor (default).
|
* than per monitor (default).
|
||||||
* https://dwm.suckless.org/patches/pertag/
|
* https://dwm.suckless.org/patches/pertag/
|
||||||
|
Loading…
Reference in New Issue
Block a user