From d8f695a7c2bff42e24980024b681b7b042dd84aa Mon Sep 17 00:00:00 2001 From: Liassica <115422798+Liassica@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:05:52 -0500 Subject: [PATCH] hyprbars: fix left align (#153) Co-authored-by: Liassica --- hyprbars/barDeco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index 13acde9..594310a 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -233,7 +233,7 @@ void CHyprBar::renderBarTitle(const Vector2D& bufferSize, const float scale) { pango_layout_set_font_description(layout, fontDesc); pango_font_description_free(fontDesc); - const int paddingTotal = scaledBarPadding * 2 + scaledButtonsSize + (*PALIGN != "left" ? scaledButtonsSize : 0); + const int paddingTotal = scaledBarPadding * 2 + scaledButtonsSize + (std::string{*PALIGN} != "left" ? scaledButtonsSize : 0); const int maxWidth = std::clamp(static_cast(bufferSize.x - paddingTotal), 0, INT_MAX); pango_layout_set_width(layout, maxWidth * PANGO_SCALE); @@ -243,7 +243,7 @@ void CHyprBar::renderBarTitle(const Vector2D& bufferSize, const float scale) { int layoutWidth, layoutHeight; pango_layout_get_size(layout, &layoutWidth, &layoutHeight); - const int xOffset = *PALIGN == "left" ? std::round(scaledBarPadding + (BUTTONSRIGHT ? 0 : scaledButtonsSize)) : + const int xOffset = std::string{*PALIGN} == "left" ? std::round(scaledBarPadding + (BUTTONSRIGHT ? 0 : scaledButtonsSize)) : std::round(((bufferSize.x - scaledBorderSize) / 2.0 - layoutWidth / PANGO_SCALE / 2.0)); const int yOffset = std::round((bufferSize.y / 2.0 - layoutHeight / PANGO_SCALE / 2.0));