speedwm-personal/bar/title-basic.c
2022-12-04 22:03:42 +01:00

45 lines
949 B
C

int
width_title_basic(Bar *bar, BarWidthArg *a)
{
if (selmon->hidetitle)
return 0;
return a->max_width;
}
int
draw_title_basic(Bar *bar, BarDrawArg *a)
{
if (selmon->hidetitle)
return 0;
int boxs = drw->font->h / 9;
int boxw = drw->font->h / 6 + 2;
int x = a->x, w = a->w;
Monitor *m = bar->mon;
if (m->sel) {
if (colorselectedtitle)
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
else
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleNorm : SchemeTitleNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {
drw_setscheme(drw, scheme[SchemeBar]);
drw_rect(drw, x, 0, w, bh, 1, 1);
}
return x + w;
}
int
click_title_basic(Bar *bar, Arg *arg, BarClickArg *a)
{
if (selmon->hidetitle)
return 0;
return ClkWinTitle;
}