summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJochim <jochim.van.dijck@gmail.com>2025-11-16 13:23:45 +0100
committerGitHub <noreply@github.com>2025-11-16 12:23:45 +0000
commitcb47eb1d11bbac1ebab8f9cd7a5f96a475eaab28 (patch)
tree86b1c374d2a7888a17b7f48a3e70820fcc80849c /src
parent9b006b2c8533bae1e528bd123be209453787b9b7 (diff)
deco/groupbar: add groupbar blur (#12310)
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigDescriptions.hpp6
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.cpp61
3 files changed, 31 insertions, 37 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index 926d49ac..5e503451 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -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:blur",
+ .description = "enable background blur for groupbars",
+ .type = CONFIG_OPTION_BOOL,
+ .data = SConfigOptionDescription::SBoolData{false},
+ },
/*
* misc:
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index a3c60d2b..b4b6ed3d 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -560,6 +560,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:blur", Hyprlang::INT{0});
registerConfigVar("debug:log_damage", Hyprlang::INT{0});
registerConfigVar("debug:overlay", Hyprlang::INT{0});
diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp
index 49fcd347..b4bf2b86 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.cpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.cpp
@@ -126,6 +126,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 PBLUR = CConfigValue<Hyprlang::INT>("group:groupbar:blur");
auto* const GROUPCOLACTIVE = sc<CGradientValueData*>((PGROUPCOLACTIVE.ptr())->getData());
auto* const GROUPCOLINACTIVE = sc<CGradientValueData*>((PGROUPCOLINACTIVE.ptr())->getData());
auto* const GROUPCOLACTIVELOCKED = sc<CGradientValueData*>((PGROUPCOLACTIVELOCKED.ptr())->getData());
@@ -144,6 +145,8 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
float xoff = 0;
float yoff = 0;
+ bool blur = *PBLUR != 0;
+
for (int i = 0; i < barsToDraw; ++i) {
const auto WINDOWINDEX = *PSTACKED ? m_dwGroupMembers.size() - i - 1 : i;
@@ -163,31 +166,23 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
if (!rect.empty()) {
CRectPassElement::SRectData rectdata;
rectdata.color = color;
+ rectdata.blur = blur;
rectdata.box = rect;
if (*PROUNDING) {
+ rectdata.round = *PROUNDING;
rectdata.roundingPower = *PROUNDINGPOWER;
if (*PROUNDONLYEDGES) {
- static constexpr double PADDING = 20;
-
- if (i == 0 && barsToDraw == 1)
- rectdata.round = *PROUNDING;
- else if (i == 0) {
- double first = rect.w - (*PROUNDING * 2);
+ if (i == 0) {
rectdata.round = *PROUNDING;
- rectdata.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}};
- g_pHyprRenderer->m_renderPass.add(makeUnique<CRectPassElement>(rectdata));
- rectdata.round = 0;
- rectdata.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
+ rectdata.clipBox = rect;
+ rectdata.box = CBox{rect.pos(), Vector2D{rect.w + (*PROUNDING * 2), rect.h}};
} else if (i == barsToDraw - 1) {
- double first = *PROUNDING * 2;
- rectdata.round = 0;
- rectdata.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}};
- g_pHyprRenderer->m_renderPass.add(makeUnique<CRectPassElement>(rectdata));
+ double offset = *PROUNDING * 2;
rectdata.round = *PROUNDING;
- rectdata.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
+ rectdata.clipBox = rect;
+ rectdata.box = CBox{rect.pos() - Vector2D{offset, 0.F}, Vector2D{rect.w + offset, rect.h}};
}
- } else
- rectdata.round = *PROUNDING;
+ }
}
g_pHyprRenderer->m_renderPass.add(makeUnique<CRectPassElement>(rectdata));
}
@@ -203,32 +198,24 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive));
if (GRADIENTTEX->m_texID) {
CTexPassElement::SRenderData data;
- data.tex = GRADIENTTEX;
- data.box = rect;
+ data.tex = GRADIENTTEX;
+ data.blur = blur;
+ data.box = rect;
if (*PGRADIENTROUNDING) {
+ data.round = *PGRADIENTROUNDING;
data.roundingPower = *PGRADIENTROUNDINGPOWER;
if (*PGRADIENTROUNDINGONLYEDGES) {
- static constexpr double PADDING = 20;
-
- if (i == 0 && barsToDraw == 1)
- data.round = *PGRADIENTROUNDING;
- else if (i == 0) {
- double first = rect.w - (*PGRADIENTROUNDING * 2);
+ if (i == 0) {
data.round = *PGRADIENTROUNDING;
- data.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}};
- g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(data));
- data.round = 0;
- data.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
+ data.clipBox = rect;
+ data.box = CBox{rect.pos(), Vector2D{rect.w + (*PGRADIENTROUNDING * 2), rect.h}};
} else if (i == barsToDraw - 1) {
- double first = *PGRADIENTROUNDING * 2;
- data.round = 0;
- data.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}};
- g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(data));
- data.round = *PGRADIENTROUNDING;
- data.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
+ double offset = *PGRADIENTROUNDING * 2;
+ data.round = *PGRADIENTROUNDING;
+ data.clipBox = rect;
+ data.box = CBox{rect.pos() - Vector2D{offset, 0.F}, Vector2D{rect.w + offset, rect.h}};
}
- } else
- data.round = *PGRADIENTROUNDING;
+ }
}
g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(data));
}