Added logic to auto-hide bars if nothing is drawn on them (e.g. for standalone bars that only show certain clients)
This commit is contained in:
@@ -23,42 +23,43 @@ draw_wintitle(Bar *bar, BarDrawArg *a)
|
||||
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
|
||||
Monitor *m = bar->mon;
|
||||
|
||||
if (m->sel) {
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
|
||||
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
XSetErrorHandler(xerrordummy);
|
||||
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int mid = (m->ww - TEXTW(m->sel->name)) / 2 - x;
|
||||
#if BAR_PANGO_PATCH
|
||||
drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0, False);
|
||||
#else
|
||||
drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
|
||||
#endif // BAR_PANGO_PATCH
|
||||
#else
|
||||
#if BAR_PANGO_PATCH
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False);
|
||||
#else
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
#endif // BAR_PANGO_PATCH
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(xerror);
|
||||
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
if (m->sel->isfloating)
|
||||
#if BAR_ACTIVETAGINDICATORBAR_PATCH
|
||||
drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, m->sel->isfixed, 0);
|
||||
#elif BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
|
||||
drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, 0);
|
||||
#else
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||
#endif // BAR_ACTIVETAGINDICATORBAR_PATCH
|
||||
} else {
|
||||
if (!m->sel) {
|
||||
drw_setscheme(drw, scheme[SchemeTitleNorm]);
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
return 0;
|
||||
}
|
||||
return x + w;
|
||||
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
|
||||
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
XSetErrorHandler(xerrordummy);
|
||||
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int mid = (m->ww - TEXTW(m->sel->name)) / 2 - x;
|
||||
#if BAR_PANGO_PATCH
|
||||
drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0, False);
|
||||
#else
|
||||
drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
|
||||
#endif // BAR_PANGO_PATCH
|
||||
#else
|
||||
#if BAR_PANGO_PATCH
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False);
|
||||
#else
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
#endif // BAR_PANGO_PATCH
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(xerror);
|
||||
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
if (m->sel->isfloating)
|
||||
#if BAR_ACTIVETAGINDICATORBAR_PATCH
|
||||
drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, m->sel->isfixed, 0);
|
||||
#elif BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
|
||||
drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, 0);
|
||||
#else
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||
#endif // BAR_ACTIVETAGINDICATORBAR_PATCH
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
|
Reference in New Issue
Block a user