summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
authorJacob Ilias Komissar <18540209+jirassimok@users.noreply.github.com>2025-06-16 16:40:38 -0400
committerGitHub <noreply@github.com>2025-06-16 22:40:38 +0200
commit0ece4af36a988ad06b28ed666011d84372d9e4dc (patch)
tree6c8404a4bce600b61e4147d8ceeb323ea3130ea3 /src/render
parentaba2cfe7a8d5c1658fe8df0095a089cc73db43ab (diff)
grpupbar: Add config options to color inactive and locked groupbar titles (#10667)
Diffstat (limited to 'src/render')
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.cpp32
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.hpp2
2 files changed, 26 insertions, 8 deletions
diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp
index 7a6eebba..386f158a 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.cpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.cpp
@@ -240,7 +240,12 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
pMonitor->m_scale))
.get();
- const auto titleTex = m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_lastWindow ? pTitleTex->m_texActive : pTitleTex->m_texInactive;
+ SP<CTexture> titleTex;
+ if (m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_lastWindow)
+ titleTex = GROUPLOCKED ? pTitleTex->m_texLockedActive : pTitleTex->m_texActive;
+ else
+ titleTex = GROUPLOCKED ? pTitleTex->m_texLockedInactive : pTitleTex->m_texInactive;
+
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;
@@ -279,10 +284,13 @@ void CHyprGroupBarDecoration::invalidateTextures() {
}
CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale) : m_content(pWindow->m_title), m_windowOwner(pWindow) {
- static auto FALLBACKFONT = CConfigValue<std::string>("misc:font_family");
- static auto PTITLEFONTFAMILY = CConfigValue<std::string>("group:groupbar:font_family");
- static auto PTITLEFONTSIZE = CConfigValue<Hyprlang::INT>("group:groupbar:font_size");
- static auto PTEXTCOLOR = CConfigValue<Hyprlang::INT>("group:groupbar:text_color");
+ static auto FALLBACKFONT = CConfigValue<std::string>("misc:font_family");
+ static auto PTITLEFONTFAMILY = CConfigValue<std::string>("group:groupbar:font_family");
+ static auto PTITLEFONTSIZE = CConfigValue<Hyprlang::INT>("group:groupbar:font_size");
+ static auto PTEXTCOLORACTIVE = CConfigValue<Hyprlang::INT>("group:groupbar:text_color");
+ static auto PTEXTCOLORINACTIVE = CConfigValue<Hyprlang::INT>("group:groupbar:text_color_inactive");
+ static auto PTEXTCOLORLOCKEDACTIVE = CConfigValue<Hyprlang::INT>("group:groupbar:text_color_locked_active");
+ static auto PTEXTCOLORLOCKEDINACTIVE = CConfigValue<Hyprlang::INT>("group:groupbar:text_color_locked_inactive");
static auto PTITLEFONTWEIGHTACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:font_weight_active");
static auto PTITLEFONTWEIGHTINACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:font_weight_inactive");
@@ -290,11 +298,19 @@ CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float
const auto FONTWEIGHTACTIVE = (CFontWeightConfigValueData*)(PTITLEFONTWEIGHTACTIVE.ptr())->getData();
const auto FONTWEIGHTINACTIVE = (CFontWeightConfigValueData*)(PTITLEFONTWEIGHTINACTIVE.ptr())->getData();
- const CHyprColor COLOR = CHyprColor(*PTEXTCOLOR);
+ const CHyprColor COLORACTIVE = CHyprColor(*PTEXTCOLORACTIVE);
+ const CHyprColor COLORINACTIVE = *PTEXTCOLORINACTIVE == -1 ? COLORACTIVE : CHyprColor(*PTEXTCOLORINACTIVE);
+ const CHyprColor COLORLOCKEDACTIVE = *PTEXTCOLORLOCKEDACTIVE == -1 ? COLORACTIVE : CHyprColor(*PTEXTCOLORLOCKEDACTIVE);
+ const CHyprColor COLORLOCKEDINACTIVE = *PTEXTCOLORLOCKEDINACTIVE == -1 ? COLORINACTIVE : CHyprColor(*PTEXTCOLORLOCKEDINACTIVE);
+
const auto FONTFAMILY = *PTITLEFONTFAMILY != STRVAL_EMPTY ? *PTITLEFONTFAMILY : *FALLBACKFONT;
- m_texActive = g_pHyprOpenGL->renderText(pWindow->m_title, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTACTIVE->m_value);
- m_texInactive = g_pHyprOpenGL->renderText(pWindow->m_title, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTINACTIVE->m_value);
+#define RENDER_TEXT(color, weight) g_pHyprOpenGL->renderText(pWindow->m_title, (color), *PTITLEFONTSIZE* monitorScale, false, FONTFAMILY, bufferSize.x - 2, (weight));
+ m_texActive = RENDER_TEXT(COLORACTIVE, FONTWEIGHTACTIVE->m_value);
+ m_texInactive = RENDER_TEXT(COLORINACTIVE, FONTWEIGHTINACTIVE->m_value);
+ m_texLockedActive = RENDER_TEXT(COLORLOCKEDACTIVE, FONTWEIGHTACTIVE->m_value);
+ m_texLockedInactive = RENDER_TEXT(COLORLOCKEDINACTIVE, FONTWEIGHTINACTIVE->m_value);
+#undef RENDER_TEXT
}
static void renderGradientTo(SP<CTexture> tex, CGradientValueData* grad) {
diff --git a/src/render/decorations/CHyprGroupBarDecoration.hpp b/src/render/decorations/CHyprGroupBarDecoration.hpp
index 5e1abc5a..3e5d3c2d 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.hpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.hpp
@@ -14,6 +14,8 @@ class CTitleTex {
SP<CTexture> m_texActive;
SP<CTexture> m_texInactive;
+ SP<CTexture> m_texLockedActive;
+ SP<CTexture> m_texLockedInactive;
std::string m_content;
PHLWINDOWREF m_windowOwner;