add option to change position of title
This commit is contained in:
parent
69881414de
commit
8a43d3ce7b
|
@ -27,6 +27,10 @@ speedwm.bar.hide.title: 0 ! Hide the window title (0/1)
|
|||
speedwm.bar.hide.unseltitle: 0 ! Hide the unselected window title (0/1)
|
||||
speedwm.bar.hide.icon: 0 ! Hide the window icon (0/1)
|
||||
|
||||
!! Title options
|
||||
|
||||
speedwm.bar.titleposition: 1 ! Position of the title (0: Left, 1: Center)
|
||||
|
||||
!! Layout indicator options
|
||||
|
||||
speedwm.bar.layoutposition: 1 ! Position of the layout indicator (0: Right, 1: Left)
|
||||
|
|
|
@ -118,6 +118,9 @@ static int barheight = 4; /* Bar height in pixels, 0 =
|
|||
static int barpaddingv = 10; /* Vertical bar padding in pixels. */
|
||||
static int barpaddingh = 10; /* Horizontal bar padding in pixels. */
|
||||
|
||||
/* Title options */
|
||||
static int titleposition = 1; /* Title position. (0: Left, 1: Center) */
|
||||
|
||||
/* Layout indicator options */
|
||||
static int layoutposition = 1; /* Layout indicator on the left (1) or on the right (0) */
|
||||
|
||||
|
|
16
speedwm.c
16
speedwm.c
|
@ -2644,6 +2644,7 @@ resizebarwin(m);
|
|||
|
||||
int remainder;
|
||||
int tabw;
|
||||
int padding;
|
||||
|
||||
/* we're doing this to make sure the title does not get truncated when there's only supposed to be one title anyway */
|
||||
if (!selmon->hideunselectedtitle) {
|
||||
|
@ -2716,6 +2717,13 @@ resizebarwin(m);
|
|||
|
||||
int pltitle = 0;
|
||||
|
||||
/* !centered title */
|
||||
padding = lrpad/2;
|
||||
|
||||
/* centered title */
|
||||
if (TEXTWM(c->name) < tabw && titleposition)
|
||||
padding = (tabw - TEXTWM(c->name) + lrpad) / 2;
|
||||
|
||||
if (!selmon->hidetitlepowerline && selmon->colorselectedtitle)
|
||||
pltitle = plt;
|
||||
|
||||
|
@ -2723,14 +2731,14 @@ resizebarwin(m);
|
|||
#if USEWINICON
|
||||
if (selmon->hideicon) {
|
||||
#endif
|
||||
drw_text(drw, x + pltitle, 0, tabw, bh, lrpad / 2, c->name, 0, False);
|
||||
drw_text(drw, x + pltitle, 0, tabw, bh, padding, c->name, 0, False);
|
||||
#if USEWINICON
|
||||
} else {
|
||||
drw_text(drw, x + pltitle, 0, tabw, bh, lrpad / 2 + (c->icon ? c->icw + selmon->iconspacing : 0), c->name, 0, False); /* draw, with icon spacing and width added */
|
||||
drw_text(drw, x + pltitle, 0, tabw, bh, padding + (c->icon ? c->icw + selmon->iconspacing : 0), c->name, 0, False); /* draw, with icon spacing and width added */
|
||||
if (c->icon && !selmon->hidetitlepowerline && selmon->colorselectedtitle)
|
||||
drw_pic(drw, x + pltitle + lrpad / 2, (bh - c->ich) / 2, c->icw, c->ich, c->icon); /* draw icon */
|
||||
drw_pic(drw, x + pltitle + padding, (bh - c->ich) / 2, c->icw, c->ich, c->icon); /* draw icon */
|
||||
else if (c->icon)
|
||||
drw_pic(drw, x + lrpad / 2, (bh - c->ich) / 2, c->icw, c->ich, c->icon); /* draw icon */
|
||||
drw_pic(drw, x + padding, (bh - c->ich) / 2, c->icw, c->ich, c->icon); /* draw icon */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ ResourcePref resources[] = {
|
|||
{ "tag.pertag", INTEGER, &pertag },
|
||||
{ "stack.i3mcount", INTEGER, &i3mastercount },
|
||||
{ "bar.layoutposition", INTEGER, &layoutposition },
|
||||
{ "bar.titleposition", INTEGER, &titleposition },
|
||||
{ "bar.hide.layout", INTEGER, &hidelayout },
|
||||
{ "bar.hide.title", INTEGER, &hidetitle },
|
||||
{ "bar.hide.unseltitle", INTEGER, &hideunselectedtitle },
|
||||
|
|
Loading…
Reference in a new issue