diff --git a/awesomerc.5.txt b/awesomerc.5.txt index d36220959..72778ea7e 100644 --- a/awesomerc.5.txt +++ b/awesomerc.5.txt @@ -543,7 +543,7 @@ Note: when there is no whitespace, quotes are optional. { font = fg = bg = border = shadow = shadow_offset = } -> a section with position and icon position. - { position = icon = } + { position = icon = text_align = <{center,right,left}> } [MULTI] means, you can use an item multiple times. diff --git a/client.c b/client.c index 1d1b36dde..95745ec55 100644 --- a/client.c +++ b/client.c @@ -157,7 +157,7 @@ client_updatetitlebar(Client *c) geometry = c->titlebar.sw->geometry; 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); 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); /* default titlebar position */ - c->titlebar.position = globalconf.screens[screen].titlebar_default.position; + c->titlebar = globalconf.screens[screen].titlebar_default; /* First check clients hints */ ewmh_check_client_hints(c); @@ -398,7 +398,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen) } if(rule && rule->titlebar.position != Auto) - c->titlebar.position = rule->titlebar.position; + c->titlebar = rule->titlebar; switch(c->titlebar.position) { diff --git a/common/configopts.c b/common/configopts.c index 870da1da4..5a49c2d39 100644 --- a/common/configopts.c +++ b/common/configopts.c @@ -70,6 +70,7 @@ cfg_awesome_include(cfg_t *cfg, cfg_opt_t *opt, cfg_opt_t titlebar_opts[] = { 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_AWESOME_END() }; diff --git a/config.c b/config.c index b76b76115..63f5c5234 100644 --- a/config.c +++ b/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->icon = position_get_from_str(cfg_getstr(cfg_titlebar, "icon")); + tb->text_align = draw_get_align(cfg_getstr(cfg_titlebar, "text_align")); } static void diff --git a/structs.h b/structs.h index db2d6c9b0..334443cd1 100644 --- a/structs.h +++ b/structs.h @@ -44,6 +44,7 @@ typedef struct { SimpleWindow *sw; Position position; + Alignment text_align; Position icon; } Titlebar;