groupbar: added group:groupbar:text_padding (#12818)
Co-authored-by: Roman Weinberger // ACL <roman.weinberger@acl.at>
This commit is contained in:
parent
f1652b2951
commit
a383ca1866
3 changed files with 15 additions and 6 deletions
|
|
@ -1115,6 +1115,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
.type = CONFIG_OPTION_BOOL,
|
||||
.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",
|
||||
|
|
|
|||
|
|
@ -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});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue