Add support for text_align option in titlebars
This commit is contained in:
parent
74777016af
commit
bc6656320d
|
@ -543,7 +543,7 @@ Note: when there is no whitespace, quotes are optional.
|
||||||
{ font = <font> fg = <color> bg = <color> border = <color>
|
{ font = <font> fg = <color> bg = <color> border = <color>
|
||||||
shadow = <color> shadow_offset = <integer> }
|
shadow = <color> shadow_offset = <integer> }
|
||||||
<titlebar> -> a section with position and icon position.
|
<titlebar> -> a section with position and icon position.
|
||||||
{ position = <position> icon = <position> }
|
{ position = <position> icon = <position> text_align = <{center,right,left}> }
|
||||||
|
|
||||||
[MULTI] means, you can use an item multiple times.
|
[MULTI] means, you can use an item multiple times.
|
||||||
|
|
||||||
|
|
6
client.c
6
client.c
|
@ -157,7 +157,7 @@ client_updatetitlebar(Client *c)
|
||||||
geometry = c->titlebar.sw->geometry;
|
geometry = c->titlebar.sw->geometry;
|
||||||
geometry.x = geometry.y = 0;
|
geometry.x = geometry.y = 0;
|
||||||
|
|
||||||
draw_text(ctx, geometry, AlignCenter, 0,
|
draw_text(ctx, geometry, c->titlebar.text_align, style.font->height / 2,
|
||||||
c->name, style);
|
c->name, style);
|
||||||
|
|
||||||
simplewindow_refresh_drawable(c->titlebar.sw, phys_screen);
|
simplewindow_refresh_drawable(c->titlebar.sw, phys_screen);
|
||||||
|
@ -358,7 +358,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
ewmh_check_client_hints(c);
|
ewmh_check_client_hints(c);
|
||||||
|
|
||||||
/* default titlebar position */
|
/* default titlebar position */
|
||||||
c->titlebar.position = globalconf.screens[screen].titlebar_default.position;
|
c->titlebar = globalconf.screens[screen].titlebar_default;
|
||||||
|
|
||||||
/* First check clients hints */
|
/* First check clients hints */
|
||||||
ewmh_check_client_hints(c);
|
ewmh_check_client_hints(c);
|
||||||
|
@ -398,7 +398,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rule && rule->titlebar.position != Auto)
|
if(rule && rule->titlebar.position != Auto)
|
||||||
c->titlebar.position = rule->titlebar.position;
|
c->titlebar = rule->titlebar;
|
||||||
|
|
||||||
switch(c->titlebar.position)
|
switch(c->titlebar.position)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,7 @@ cfg_awesome_include(cfg_t *cfg, cfg_opt_t *opt,
|
||||||
cfg_opt_t titlebar_opts[] =
|
cfg_opt_t titlebar_opts[] =
|
||||||
{
|
{
|
||||||
CFG_STR((char *) "position", (char *) "auto", CFGF_NONE),
|
CFG_STR((char *) "position", (char *) "auto", CFGF_NONE),
|
||||||
|
CFG_STR((char *) "text_align", (char *) "center", CFGF_NONE),
|
||||||
CFG_STR((char *) "icon", (char *) "left", CFGF_NONE),
|
CFG_STR((char *) "icon", (char *) "left", CFGF_NONE),
|
||||||
CFG_AWESOME_END()
|
CFG_AWESOME_END()
|
||||||
};
|
};
|
||||||
|
|
1
config.c
1
config.c
|
@ -277,6 +277,7 @@ config_section_titlebar_init(cfg_t *cfg_titlebar, Titlebar *tb)
|
||||||
{
|
{
|
||||||
tb->position = position_get_from_str(cfg_getstr(cfg_titlebar, "position"));
|
tb->position = position_get_from_str(cfg_getstr(cfg_titlebar, "position"));
|
||||||
tb->icon = position_get_from_str(cfg_getstr(cfg_titlebar, "icon"));
|
tb->icon = position_get_from_str(cfg_getstr(cfg_titlebar, "icon"));
|
||||||
|
tb->text_align = draw_get_align(cfg_getstr(cfg_titlebar, "text_align"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue