diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 84060e0dc..65d7d7ffd 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -29,7 +29,6 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() { static auto PHEIGHT = CConfigValue("group:groupbar:height"); static auto PINDICATORGAP = CConfigValue("group:groupbar:indicator_gap"); static auto PINDICATORHEIGHT = CConfigValue("group:groupbar:indicator_height"); - static auto PENABLED = CConfigValue("group:groupbar:enabled"); static auto PRENDERTITLES = CConfigValue("group:groupbar:render_titles"); static auto PGRADIENTS = CConfigValue("group:groupbar:gradients"); static auto PPRIORITY = CConfigValue("group:groupbar:priority"); @@ -43,7 +42,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() { info.priority = *PPRIORITY; info.reserved = true; - if (*PENABLED && m_window->m_windowData.decorate.valueOrDefault()) { + if (visible()) { if (*PSTACKED) { const auto ONEBARHEIGHT = *POUTERGAP + *PINDICATORHEIGHT + *PINDICATORGAP + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0); info.desiredExtents = {{0, (ONEBARHEIGHT * m_dwGroupMembers.size()) + (*PKEEPUPPERGAP * *POUTERGAP)}, {0, 0}}; @@ -96,11 +95,14 @@ void CHyprGroupBarDecoration::damageEntire() { void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { // get how many bars we will draw - int barsToDraw = m_dwGroupMembers.size(); + int barsToDraw = m_dwGroupMembers.size(); - static auto PENABLED = CConfigValue("group:groupbar:enabled"); + const bool VISIBLE = visible(); - if (!*PENABLED || !m_window->m_windowData.decorate.valueOrDefault()) + if (VISIBLE != m_bLastVisibilityStatus) + g_pDecorationPositioner->repositionDeco(this); + + if (!VISIBLE) return; static auto PRENDERTITLES = CConfigValue("group:groupbar:render_titles"); @@ -583,3 +585,8 @@ CBox CHyprGroupBarDecoration::assignedBoxGlobal() { return box.round(); } + +bool CHyprGroupBarDecoration::visible() { + static auto PENABLED = CConfigValue("group:groupbar:enabled"); + return *PENABLED && m_window->m_windowData.decorate.valueOrDefault(); +} diff --git a/src/render/decorations/CHyprGroupBarDecoration.hpp b/src/render/decorations/CHyprGroupBarDecoration.hpp index feb304f2f..5e1abc5a4 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.hpp +++ b/src/render/decorations/CHyprGroupBarDecoration.hpp @@ -56,10 +56,13 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration { float m_barWidth; float m_barHeight; + bool m_bLastVisibilityStatus = true; + CTitleTex* textureFromTitle(const std::string&); void invalidateTextures(); CBox assignedBoxGlobal(); + bool visible(); bool onBeginWindowDragOnDeco(const Vector2D&); bool onEndWindowDragOnDeco(const Vector2D&, PHLWINDOW);