mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 12:30:03 +01:00
deco/groupbar: add groupbar blur (#12310)
This commit is contained in:
parent
9b006b2c85
commit
cb47eb1d11
3 changed files with 31 additions and 37 deletions
|
|
@ -1115,6 +1115,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_BOOL,
|
.type = CONFIG_OPTION_BOOL,
|
||||||
.data = SConfigOptionDescription::SRangeData{0, -20, 20},
|
.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:
|
* misc:
|
||||||
|
|
|
||||||
|
|
@ -560,6 +560,7 @@ CConfigManager::CConfigManager() {
|
||||||
registerConfigVar("group:groupbar:gaps_in", Hyprlang::INT{2});
|
registerConfigVar("group:groupbar:gaps_in", Hyprlang::INT{2});
|
||||||
registerConfigVar("group:groupbar:keep_upper_gap", Hyprlang::INT{1});
|
registerConfigVar("group:groupbar:keep_upper_gap", Hyprlang::INT{1});
|
||||||
registerConfigVar("group:groupbar:text_offset", Hyprlang::INT{0});
|
registerConfigVar("group:groupbar:text_offset", Hyprlang::INT{0});
|
||||||
|
registerConfigVar("group:groupbar:blur", Hyprlang::INT{0});
|
||||||
|
|
||||||
registerConfigVar("debug:log_damage", Hyprlang::INT{0});
|
registerConfigVar("debug:log_damage", Hyprlang::INT{0});
|
||||||
registerConfigVar("debug:overlay", Hyprlang::INT{0});
|
registerConfigVar("debug:overlay", Hyprlang::INT{0});
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||||
static auto PINNERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_in");
|
static auto PINNERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_in");
|
||||||
static auto PKEEPUPPERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:keep_upper_gap");
|
static auto PKEEPUPPERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:keep_upper_gap");
|
||||||
static auto PTEXTOFFSET = CConfigValue<Hyprlang::INT>("group:groupbar:text_offset");
|
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 GROUPCOLACTIVE = sc<CGradientValueData*>((PGROUPCOLACTIVE.ptr())->getData());
|
||||||
auto* const GROUPCOLINACTIVE = sc<CGradientValueData*>((PGROUPCOLINACTIVE.ptr())->getData());
|
auto* const GROUPCOLINACTIVE = sc<CGradientValueData*>((PGROUPCOLINACTIVE.ptr())->getData());
|
||||||
auto* const GROUPCOLACTIVELOCKED = sc<CGradientValueData*>((PGROUPCOLACTIVELOCKED.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 xoff = 0;
|
||||||
float yoff = 0;
|
float yoff = 0;
|
||||||
|
|
||||||
|
bool blur = *PBLUR != 0;
|
||||||
|
|
||||||
for (int i = 0; i < barsToDraw; ++i) {
|
for (int i = 0; i < barsToDraw; ++i) {
|
||||||
const auto WINDOWINDEX = *PSTACKED ? m_dwGroupMembers.size() - i - 1 : 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()) {
|
if (!rect.empty()) {
|
||||||
CRectPassElement::SRectData rectdata;
|
CRectPassElement::SRectData rectdata;
|
||||||
rectdata.color = color;
|
rectdata.color = color;
|
||||||
|
rectdata.blur = blur;
|
||||||
rectdata.box = rect;
|
rectdata.box = rect;
|
||||||
if (*PROUNDING) {
|
if (*PROUNDING) {
|
||||||
|
rectdata.round = *PROUNDING;
|
||||||
rectdata.roundingPower = *PROUNDINGPOWER;
|
rectdata.roundingPower = *PROUNDINGPOWER;
|
||||||
if (*PROUNDONLYEDGES) {
|
if (*PROUNDONLYEDGES) {
|
||||||
static constexpr double PADDING = 20;
|
if (i == 0) {
|
||||||
|
|
||||||
if (i == 0 && barsToDraw == 1)
|
|
||||||
rectdata.round = *PROUNDING;
|
rectdata.round = *PROUNDING;
|
||||||
else if (i == 0) {
|
rectdata.clipBox = rect;
|
||||||
double first = rect.w - (*PROUNDING * 2);
|
rectdata.box = CBox{rect.pos(), Vector2D{rect.w + (*PROUNDING * 2), rect.h}};
|
||||||
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}};
|
|
||||||
} else if (i == barsToDraw - 1) {
|
} else if (i == barsToDraw - 1) {
|
||||||
double first = *PROUNDING * 2;
|
double offset = *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));
|
|
||||||
rectdata.round = *PROUNDING;
|
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));
|
g_pHyprRenderer->m_renderPass.add(makeUnique<CRectPassElement>(rectdata));
|
||||||
}
|
}
|
||||||
|
|
@ -204,31 +199,23 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
||||||
if (GRADIENTTEX->m_texID) {
|
if (GRADIENTTEX->m_texID) {
|
||||||
CTexPassElement::SRenderData data;
|
CTexPassElement::SRenderData data;
|
||||||
data.tex = GRADIENTTEX;
|
data.tex = GRADIENTTEX;
|
||||||
|
data.blur = blur;
|
||||||
data.box = rect;
|
data.box = rect;
|
||||||
if (*PGRADIENTROUNDING) {
|
if (*PGRADIENTROUNDING) {
|
||||||
|
data.round = *PGRADIENTROUNDING;
|
||||||
data.roundingPower = *PGRADIENTROUNDINGPOWER;
|
data.roundingPower = *PGRADIENTROUNDINGPOWER;
|
||||||
if (*PGRADIENTROUNDINGONLYEDGES) {
|
if (*PGRADIENTROUNDINGONLYEDGES) {
|
||||||
static constexpr double PADDING = 20;
|
if (i == 0) {
|
||||||
|
|
||||||
if (i == 0 && barsToDraw == 1)
|
|
||||||
data.round = *PGRADIENTROUNDING;
|
data.round = *PGRADIENTROUNDING;
|
||||||
else if (i == 0) {
|
data.clipBox = rect;
|
||||||
double first = rect.w - (*PGRADIENTROUNDING * 2);
|
data.box = CBox{rect.pos(), Vector2D{rect.w + (*PGRADIENTROUNDING * 2), rect.h}};
|
||||||
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}};
|
|
||||||
} else if (i == barsToDraw - 1) {
|
} else if (i == barsToDraw - 1) {
|
||||||
double first = *PGRADIENTROUNDING * 2;
|
double offset = *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.round = *PGRADIENTROUNDING;
|
||||||
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{offset, 0.F}, Vector2D{rect.w + offset, rect.h}};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
data.round = *PGRADIENTROUNDING;
|
|
||||||
}
|
}
|
||||||
g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(data));
|
g_pHyprRenderer->m_renderPass.add(makeUnique<CTexPassElement>(data));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue