diff options
| author | wbg <rw@roman-weinberger.net> | 2026-01-07 16:52:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-07 16:52:02 +0100 |
| commit | a383ca1866b04d175bc2cf208859147d22a6968e (patch) | |
| tree | 33dbd2a42ebbd7b7886835dc73ec1f0349206b20 | |
| parent | f1652b295130fd241bd3a6505908d6db562fdcf1 (diff) | |
groupbar: added group:groupbar:text_padding (#12818)
Co-authored-by: Roman Weinberger // ACL <roman.weinberger@acl.at>
| -rw-r--r-- | src/config/ConfigDescriptions.hpp | 6 | ||||
| -rw-r--r-- | src/config/ConfigManager.cpp | 1 | ||||
| -rw-r--r-- | src/render/decorations/CHyprGroupBarDecoration.cpp | 14 |
3 files changed, 15 insertions, 6 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp index 132b4789..6e0c2958 100644 --- a/src/config/ConfigDescriptions.hpp +++ b/src/config/ConfigDescriptions.hpp @@ -1116,6 +1116,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = { .data = SConfigOptionDescription::SRangeData{0, -20, 20}, }, SConfigOptionDescription{ + .value = "group:groupbar:text_padding", + .description = "set horizontal padding for a text", + .type = CONFIG_OPTION_BOOL, + .data = SConfigOptionDescription::SRangeData{0, 0, 22}, + }, + SConfigOptionDescription{ .value = "group:groupbar:blur", .description = "enable background blur for groupbars", .type = CONFIG_OPTION_BOOL, diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 36667d84..592d0077 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -553,6 +553,7 @@ CConfigManager::CConfigManager() { registerConfigVar("group:groupbar:gaps_in", Hyprlang::INT{2}); registerConfigVar("group:groupbar:keep_upper_gap", Hyprlang::INT{1}); registerConfigVar("group:groupbar:text_offset", Hyprlang::INT{0}); + registerConfigVar("group:groupbar:text_padding", Hyprlang::INT{0}); registerConfigVar("group:groupbar:blur", Hyprlang::INT{0}); registerConfigVar("debug:log_damage", Hyprlang::INT{0}); diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 93a17341..47e39211 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -127,6 +127,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { static auto PINNERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_in"); static auto PKEEPUPPERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:keep_upper_gap"); static auto PTEXTOFFSET = CConfigValue<Hyprlang::INT>("group:groupbar:text_offset"); + static auto PTEXTPADDING = CConfigValue<Hyprlang::INT>("group:groupbar:text_padding"); static auto PBLUR = CConfigValue<Hyprlang::INT>("group:groupbar:blur"); auto* const GROUPCOLACTIVE = sc<CGradientValueData*>((PGROUPCOLACTIVE.ptr())->getData()); auto* const GROUPCOLINACTIVE = sc<CGradientValueData*>((PGROUPCOLINACTIVE.ptr())->getData()); @@ -228,11 +229,12 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[WINDOWINDEX]->m_title); if (!pTitleTex) - pTitleTex = m_titleTexs.titleTexs - .emplace_back(makeUnique<CTitleTex>(m_dwGroupMembers[WINDOWINDEX].lock(), - Vector2D{m_barWidth * pMonitor->m_scale, (*PTITLEFONTSIZE + 2L * BAR_TEXT_PAD) * pMonitor->m_scale}, - pMonitor->m_scale)) - .get(); + pTitleTex = + m_titleTexs.titleTexs + .emplace_back(makeUnique<CTitleTex>( + m_dwGroupMembers[WINDOWINDEX].lock(), + Vector2D{(m_barWidth - (*PTEXTPADDING * 2)) * pMonitor->m_scale, (*PTITLEFONTSIZE + 2L * BAR_TEXT_PAD) * pMonitor->m_scale}, pMonitor->m_scale)) + .get(); SP<CTexture> titleTex; if (m_dwGroupMembers[WINDOWINDEX] == Desktop::focusState()->window()) @@ -243,7 +245,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { rect.y += std::ceil(((rect.height - titleTex->m_size.y) / 2.0) - (*PTEXTOFFSET * pMonitor->m_scale)); rect.height = titleTex->m_size.y; rect.width = titleTex->m_size.x; - rect.x += std::round(((m_barWidth * pMonitor->m_scale) / 2.0) - (titleTex->m_size.x / 2.0)); + rect.x += std::round((((m_barWidth + *PTEXTPADDING) * pMonitor->m_scale) / 2.0) - ((titleTex->m_size.x + *PTEXTPADDING) / 2.0)); rect.round(); CTexPassElement::SRenderData data; |
