speedwm-personal/bar/title-basic.c

64 lines
1.8 KiB
C
Raw Permalink Normal View History

2022-12-03 17:54:18 +01:00
int
width_title_basic(Bar *bar, BarWidthArg *a)
{
2022-12-04 22:20:17 +01:00
if (selmon->hidetitle) {
2022-12-04 22:03:42 +01:00
return 0;
2022-12-04 22:20:17 +01:00
}
2022-12-04 22:03:42 +01:00
2022-12-03 17:54:18 +01:00
return a->max_width;
}
int
draw_title_basic(Bar *bar, BarDrawArg *a)
{
2022-12-04 22:20:17 +01:00
if (selmon->hidetitle) {
2022-12-04 22:03:42 +01:00
return 0;
2022-12-04 22:20:17 +01:00
}
2022-12-04 22:03:42 +01:00
2022-12-03 17:54:18 +01:00
int boxs = drw->font->h / 9;
int boxw = drw->font->h / 6 + 2;
int x = a->x, w = a->w;
int padding = lrpad / 2;
2022-12-03 17:54:18 +01:00
Monitor *m = bar->mon;
Client *c = m->sel;
2022-12-03 17:54:18 +01:00
if (m->sel) {
2022-12-04 12:45:51 +01:00
if (colorselectedtitle)
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
else
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleNorm : SchemeTitleNorm]);
if (TEXTW(c->name) < w && titleposition)
padding = (w - TEXTW(c->name) + lrpad) / 2;
#if USEWINICON
if (!selmon->hideicon)
drw_text(drw, x, 0, w, bh, padding + (c->icon ? c->icw + iconspacing : 0), c->name, 0, False);
else
drw_text(drw, x, 0, w, bh, padding, c->name, 0, False);
if (c->icon && !selmon->hideicon)
drw_pic(drw, x + padding, (bh - c->ich) / 2, c->icw, c->ich, c->icon);
#else
drw_text(drw, x, 0, w, bh, padding, c->name, 0, False);
#endif
if (c->isfloating && !selmon->hidefloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0);
if (c->issticky && !selmon->hidesticky)
drw_polygon(drw, x + boxs, c->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, boxw * stickyiconbb.y / stickyiconbb.x, stickyicon, LENGTH(stickyicon), Nonconvex, c->tags & bar->mon->tagset[bar->mon->seltags]);
2022-12-03 17:54:18 +01:00
} 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)
{
2022-12-04 22:20:17 +01:00
if (selmon->hidetitle) {
2022-12-04 22:03:42 +01:00
return 0;
2022-12-04 22:20:17 +01:00
}
2022-12-04 22:03:42 +01:00
2022-12-30 15:05:50 +01:00
return clicktitle;
2022-12-03 17:54:18 +01:00
}