allow disabling groupbar

modified:   src/config/ConfigManager.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.hpp

Signed-off-by: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com>
This commit is contained in:
MightyPlaza 2023-09-12 23:02:58 +01:00
parent 4b1338bbab
commit 54575656ce
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D
3 changed files with 13 additions and 4 deletions

View file

@ -127,6 +127,7 @@ void CConfigManager::setDefaultVars() {
configValues["group:insert_after_current"].intValue = 1;
configValues["group:focus_removed_window"].intValue = 1;
configValues["group:groupbar:enabled"].intValue = 1;
configValues["group:groupbar:font"].strValue = "Sans";
configValues["group:groupbar:height"].intValue = 20;
configValues["group:groupbar:mode"].intValue = 1;

View file

@ -72,7 +72,7 @@ void CHyprGroupBarDecoration::damageEntire() {
}
void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
if (!m_pWindow->m_sSpecialRenderData.decorate)
if (!m_pWindow->m_sSpecialRenderData.decorate || !m_bEnabled)
return;
int barsToDraw = m_dwGroupMembers.size();
@ -339,19 +339,26 @@ void CHyprGroupBarDecoration::refreshGradients() {
}
void CHyprGroupBarDecoration::forceReload(CWindow* pWindow) {
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue;
static auto* const PMODE = &g_pConfigManager->getConfigValuePtr("group:groupbar:mode")->intValue;
static auto* const PHEIGHT = &g_pConfigManager->getConfigValuePtr("group:groupbar:height")->intValue;
static auto* const PINTERNALBORDER = &g_pConfigManager->getConfigValuePtr("group:groupbar:internal_bar")->intValue;
m_bEnabled = *PENABLED;
m_iBarInternalHeight = *PHEIGHT + (*PMODE == 1 ? BAR_INDICATOR_HEIGHT + BAR_INTERNAL_PADDING : 0);
m_iBarFullHeight = m_iBarInternalHeight + BAR_INTERNAL_PADDING + BAR_EXTERNAL_PADDING;
m_bOnTop = g_pConfigManager->getConfigValuePtr("group:groupbar:top")->intValue;
m_bInternalBorder = *PINTERNALBORDER;
if (m_bEnabled) {
m_seExtents.topLeft = Vector2D(0, m_bOnTop ? m_iBarFullHeight : 0);
m_seExtents.bottomRight = Vector2D(0, m_bOnTop ? 0 : m_iBarFullHeight);
m_seExtents.isInternalDecoration = *PINTERNALBORDER;
} else {
m_seExtents.topLeft = Vector2D(0, 0);
m_seExtents.bottomRight = Vector2D(0, 0);
}
m_iBarHeight = *PMODE != 1 ? *PHEIGHT : BAR_INDICATOR_HEIGHT;
m_iGradientHeight = *PMODE == 1 ? *PHEIGHT : 0;

View file

@ -47,6 +47,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
std::deque<CWindow*> m_dwGroupMembers;
bool m_bEnabled;
int m_iBarInternalHeight;
int m_iBarFullHeight;
bool m_bOnTop;