center basic title, c->name in basic title

improve title.c
cleanup speedwm.c
This commit is contained in:
speedie 2022-12-06 20:19:50 +01:00
parent 5225b41335
commit 88e8956896
3 changed files with 12 additions and 5 deletions

View file

@ -18,7 +18,9 @@ draw_title_basic(Bar *bar, BarDrawArg *a)
int boxs = drw->font->h / 9; int boxs = drw->font->h / 9;
int boxw = drw->font->h / 6 + 2; int boxw = drw->font->h / 6 + 2;
int x = a->x, w = a->w; int x = a->x, w = a->w;
int padding = lrpad / 2;
Monitor *m = bar->mon; Monitor *m = bar->mon;
Client *c = m->sel;
if (m->sel) { if (m->sel) {
if (colorselectedtitle) if (colorselectedtitle)
@ -26,9 +28,14 @@ draw_title_basic(Bar *bar, BarDrawArg *a)
else else
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleNorm : SchemeTitleNorm]); drw_setscheme(drw, scheme[m == selmon ? SchemeTitleNorm : SchemeTitleNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False); if (TEXTW(c->name) < w && titleposition)
if (m->sel->isfloating) padding = (w - TEXTW(c->name) + lrpad) / 2;
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
drw_text(drw, x, 0, w, bh, padding, c->name, 0, False);
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]);
} else { } else {
drw_setscheme(drw, scheme[SchemeBar]); drw_setscheme(drw, scheme[SchemeBar]);
drw_rect(drw, x, 0, w, bh, 1, 1); drw_rect(drw, x, 0, w, bh, 1, 1);

View file

@ -18,8 +18,8 @@ draw_title(Bar *bar, BarDrawArg *a)
int n = 0, scm, remainder = 0, tabw, padding; int n = 0, scm, remainder = 0, tabw, padding;
unsigned int i; unsigned int i;
int x = a->x, w = a->w; int x = a->x, w = a->w;
Client *c;
Client *c;
for (c = bar->mon->clients; c; c = c->next) for (c = bar->mon->clients; c; c = c->next)
if (ISVISIBLE(c)) if (ISVISIBLE(c))
n++; n++;
@ -51,6 +51,7 @@ draw_title(Bar *bar, BarDrawArg *a)
#else #else
drw_text(drw, x, 0, tabw + padding (i < remainder ? 1 : 0), bh, padding, c->name, 0, False); drw_text(drw, x, 0, tabw + padding (i < remainder ? 1 : 0), bh, padding, c->name, 0, False);
#endif #endif
x += tabw + (i < remainder ? 1 : 0); x += tabw + (i < remainder ? 1 : 0);
} }
} }

View file

@ -870,7 +870,6 @@ static xcb_connection_t *xcon;
#define SUPERR Mod5Mask #define SUPERR Mod5Mask
/* Shell command */ /* Shell command */
#define RCMD(cmd) {.v = (const char*[]){ shell, "-c", cmd, NULL } },
#define cmd( cmd ) {.v = (const char*[]){ shell, "-c", cmd, NULL } }, #define cmd( cmd ) {.v = (const char*[]){ shell, "-c", cmd, NULL } },
static const char *clickstatus[] = { "/bin/sh", "-c", NULL, NULL }; /* for running click scripts */ static const char *clickstatus[] = { "/bin/sh", "-c", NULL, NULL }; /* for running click scripts */