mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 10:43:40 +01:00
Merge pull request #54 from Olekoop/master
Add option to center window title
This commit is contained in:
commit
a92314b57a
3 changed files with 8 additions and 0 deletions
|
@ -201,6 +201,9 @@ plugin {
|
|||
# render the window title on the bar
|
||||
render_text = <bool> # default: true
|
||||
|
||||
# center the window title
|
||||
text_center = <bool> # default: false
|
||||
|
||||
# font to render the window title with
|
||||
text_font = <string> # default: Sans
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
|
|||
// clang-format off
|
||||
static const auto* s_rounding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue;
|
||||
static const auto* render_text = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:render_text")->intValue;
|
||||
static const auto* text_center = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_center")->intValue;
|
||||
static const auto* text_font = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_font")->strValue;
|
||||
static const auto* text_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_height")->intValue;
|
||||
static const auto* text_padding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_padding")->intValue;
|
||||
|
@ -224,6 +225,9 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
|
|||
PangoLayout* layout = pango_cairo_create_layout(cairo);
|
||||
pango_layout_set_text(layout, this->window_title.c_str(), -1);
|
||||
|
||||
if (*text_center)
|
||||
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
|
||||
|
||||
PangoFontDescription* font_desc = pango_font_description_from_string(text_font->c_str());
|
||||
pango_font_description_set_size(font_desc, *text_height * scale * PANGO_SCALE);
|
||||
pango_layout_set_font_description(layout, font_desc);
|
||||
|
|
|
@ -44,6 +44,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
|||
CONF("tabs:from_top", int, 0);
|
||||
CONF("tabs:rounding", int, 3);
|
||||
CONF("tabs:render_text", int, 1);
|
||||
CONF("tabs:text_center", int, 0);
|
||||
CONF("tabs:text_font", str, "Sans");
|
||||
CONF("tabs:text_height", int, 8);
|
||||
CONF("tabs:text_padding", int, 3);
|
||||
|
|
Loading…
Add table
Reference in a new issue