Add configuration option for title truncation string

Permit to use arbitrary string instead of "..." (ie "$") when truncating
client title.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
This commit is contained in:
Quentin Rameau 2016-01-04 02:21:04 +01:00 committed by Christoph Lohmann
parent eb0ff62120
commit 8920c1ba19
2 changed files with 7 additions and 3 deletions

View file

@ -10,6 +10,7 @@ static const char* urgbgcolor = "#111111";
static const char* urgfgcolor = "#cc0000";
static const char before[] = "<";
static const char after[] = ">";
static const char titletrim[] = "...";
static const int tabwidth = 200;
static const Bool foreground = True;
static Bool urgentswitch = False;

View file

@ -369,7 +369,7 @@ drawbar(void)
void
drawtext(const char *text, unsigned long col[ColLast])
{
int i, x, y, h, len, olen;
int i, j, x, y, h, len, olen;
char buf[256];
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
@ -391,8 +391,11 @@ drawtext(const char *text, unsigned long col[ColLast])
return;
memcpy(buf, text, len);
if (len < olen)
for(i = len; i && i > len - 3; buf[--i] = '.');
if (len < olen) {
for (i = len, j = strlen(titletrim); j && i;
buf[--i] = titletrim[--j])
;
}
XSetForeground(dpy, dc.gc, col[ColFG]);
if (dc.font.set)