diff --git a/hyprbars/README.md b/hyprbars/README.md index 2a43492..e966503 100644 --- a/hyprbars/README.md +++ b/hyprbars/README.md @@ -28,6 +28,8 @@ plugin { `col.text` -> (col) bar's title text color +`bar_title_enabled` -> (bool) whether to render the title (default `true`) + `bar_text_size` -> (int) bar's title text font size (default `10`) `bar_text_font` -> (str) bar's title text font (default `Sans`) diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index 88d71e1..fc01f87 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -380,6 +380,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) { static auto* const PHEIGHT = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_height")->intValue; static auto* const PPRECEDENCE = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_precedence_over_border")->intValue; static auto* const PALIGNBUTTONS = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_buttons_alignment")->strValue; + static auto* const PENABLETITLE = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_title_enabled")->intValue; const bool BUTTONSRIGHT = *PALIGNBUTTONS != "left"; @@ -438,7 +439,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) { g_pHyprOpenGL->renderRect(&titleBarBox, color, scaledRounding); // render title - if (m_szLastTitle != m_pWindow->m_szTitle || m_bWindowSizeChanged || m_tTextTex.m_iTexID == 0) { + if (*PENABLETITLE && (m_szLastTitle != m_pWindow->m_szTitle || m_bWindowSizeChanged || m_tTextTex.m_iTexID == 0)) { m_szLastTitle = m_pWindow->m_szTitle; renderBarTitle(BARBUF, pMonitor->scale); } @@ -453,7 +454,8 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) { } CBox textBox = {titleBarBox.x, titleBarBox.y, (int)BARBUF.x, (int)BARBUF.y}; - g_pHyprOpenGL->renderTexture(m_tTextTex, &textBox, a); + if (*PENABLETITLE) + g_pHyprOpenGL->renderTexture(m_tTextTex, &textBox, a); if (m_bButtonsDirty || m_bWindowSizeChanged) { renderBarButtons(BARBUF, pMonitor->scale); diff --git a/hyprbars/main.cpp b/hyprbars/main.cpp index b8ff4c7..128b75a 100644 --- a/hyprbars/main.cpp +++ b/hyprbars/main.cpp @@ -69,6 +69,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_height", SConfigValue{.intValue = 15}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:col.text", SConfigValue{.intValue = configStringToInt("rgba(ffffffff)")}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_size", SConfigValue{.intValue = 10}); + HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_title_enabled", SConfigValue{.intValue = 1}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_font", SConfigValue{.strValue = "Sans"}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_align", SConfigValue{.strValue = "center"}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_part_of_window", SConfigValue{.intValue = 1});