mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2025-01-09 13:59:48 +01:00
parent
8a29b42dbe
commit
a98c16ded5
5 changed files with 36 additions and 15 deletions
|
@ -11,7 +11,19 @@ void CBarPassElement::draw(const CRegion& damage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBarPassElement::needsLiveBlur() {
|
bool CBarPassElement::needsLiveBlur() {
|
||||||
return false;
|
static auto* const PCOLOR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_color")->getDataStaticPtr();
|
||||||
|
static auto* const PENABLEBLUR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_blur")->getDataStaticPtr();
|
||||||
|
static auto* const PENABLEBLURGLOBAL = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "decoration:blur:enabled")->getDataStaticPtr();
|
||||||
|
|
||||||
|
CHyprColor color = data.deco->m_bForcedBarColor.value_or(**PCOLOR);
|
||||||
|
color.a *= data.a;
|
||||||
|
const bool SHOULDBLUR = **PENABLEBLUR && **PENABLEBLURGLOBAL && color.a < 1.F;
|
||||||
|
|
||||||
|
return SHOULDBLUR;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> CBarPassElement::boundingBox() {
|
||||||
|
return data.deco->assignedBoxGlobal().translate(-g_pHyprOpenGL->m_RenderData.pMonitor->vecPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBarPassElement::needsPrecomputeBlur() {
|
bool CBarPassElement::needsPrecomputeBlur() {
|
||||||
|
|
|
@ -16,6 +16,7 @@ class CBarPassElement : public IPassElement {
|
||||||
virtual void draw(const CRegion& damage);
|
virtual void draw(const CRegion& damage);
|
||||||
virtual bool needsLiveBlur();
|
virtual bool needsLiveBlur();
|
||||||
virtual bool needsPrecomputeBlur();
|
virtual bool needsPrecomputeBlur();
|
||||||
|
virtual std::optional<CBox> boundingBox();
|
||||||
|
|
||||||
virtual const char* passName() {
|
virtual const char* passName() {
|
||||||
return "CBarPassElement";
|
return "CBarPassElement";
|
||||||
|
|
|
@ -26,6 +26,8 @@ plugin {
|
||||||
|
|
||||||
`bar_height` -> (int) bar's height (default `15`)
|
`bar_height` -> (int) bar's height (default `15`)
|
||||||
|
|
||||||
|
`bar_blur` -> (bool) whether to blur the bar. Also requires the global blur to be enabled.
|
||||||
|
|
||||||
`col.text` -> (col) bar's title text color
|
`col.text` -> (col) bar's title text color
|
||||||
|
|
||||||
`bar_title_enabled` -> (bool) whether to render the title (default `true`)
|
`bar_title_enabled` -> (bool) whether to render the title (default `true`)
|
||||||
|
|
|
@ -414,8 +414,13 @@ void CHyprBar::renderPass(PHLMONITOR pMonitor, const float& a) {
|
||||||
static auto* const PPRECEDENCE = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_precedence_over_border")->getDataStaticPtr();
|
static auto* const PPRECEDENCE = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_precedence_over_border")->getDataStaticPtr();
|
||||||
static auto* const PALIGNBUTTONS = (Hyprlang::STRING const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_buttons_alignment")->getDataStaticPtr();
|
static auto* const PALIGNBUTTONS = (Hyprlang::STRING const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_buttons_alignment")->getDataStaticPtr();
|
||||||
static auto* const PENABLETITLE = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_title_enabled")->getDataStaticPtr();
|
static auto* const PENABLETITLE = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_title_enabled")->getDataStaticPtr();
|
||||||
|
static auto* const PENABLEBLUR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_blur")->getDataStaticPtr();
|
||||||
|
static auto* const PENABLEBLURGLOBAL = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "decoration:blur:enabled")->getDataStaticPtr();
|
||||||
|
|
||||||
|
CHyprColor color = m_bForcedBarColor.value_or(**PCOLOR);
|
||||||
|
color.a *= a;
|
||||||
const bool BUTTONSRIGHT = std::string{*PALIGNBUTTONS} != "left";
|
const bool BUTTONSRIGHT = std::string{*PALIGNBUTTONS} != "left";
|
||||||
|
const bool SHOULDBLUR = **PENABLEBLUR && **PENABLEBLURGLOBAL && color.a < 1.F;
|
||||||
|
|
||||||
if (**PHEIGHT < 1) {
|
if (**PHEIGHT < 1) {
|
||||||
m_iLastHeight = **PHEIGHT;
|
m_iLastHeight = **PHEIGHT;
|
||||||
|
@ -429,9 +434,6 @@ void CHyprBar::renderPass(PHLMONITOR pMonitor, const float& a) {
|
||||||
|
|
||||||
const auto scaledRounding = ROUNDING > 0 ? ROUNDING * pMonitor->scale - 2 /* idk why but otherwise it looks bad due to the gaps */ : 0;
|
const auto scaledRounding = ROUNDING > 0 ? ROUNDING * pMonitor->scale - 2 /* idk why but otherwise it looks bad due to the gaps */ : 0;
|
||||||
|
|
||||||
CHyprColor color = m_bForcedBarColor.value_or(**PCOLOR);
|
|
||||||
color.a *= a;
|
|
||||||
|
|
||||||
m_seExtents = {{0, **PHEIGHT}, {}};
|
m_seExtents = {{0, **PHEIGHT}, {}};
|
||||||
|
|
||||||
const auto DECOBOX = assignedBoxGlobal();
|
const auto DECOBOX = assignedBoxGlobal();
|
||||||
|
@ -475,6 +477,9 @@ void CHyprBar::renderPass(PHLMONITOR pMonitor, const float& a) {
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SHOULDBLUR)
|
||||||
|
g_pHyprOpenGL->renderRectWithBlur(&titleBarBox, color, scaledRounding, a);
|
||||||
|
else
|
||||||
g_pHyprOpenGL->renderRect(&titleBarBox, color, scaledRounding);
|
g_pHyprOpenGL->renderRect(&titleBarBox, color, scaledRounding);
|
||||||
|
|
||||||
// render title
|
// render title
|
||||||
|
|
|
@ -111,6 +111,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:col.text", Hyprlang::INT{*configStringToInt("rgba(ffffffff)")});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:col.text", Hyprlang::INT{*configStringToInt("rgba(ffffffff)")});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_size", Hyprlang::INT{10});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_size", Hyprlang::INT{10});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_title_enabled", Hyprlang::INT{1});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_title_enabled", Hyprlang::INT{1});
|
||||||
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_blur", Hyprlang::INT{0});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_font", Hyprlang::STRING{"Sans"});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_font", Hyprlang::STRING{"Sans"});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_align", Hyprlang::STRING{"center"});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_align", Hyprlang::STRING{"center"});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_part_of_window", Hyprlang::INT{1});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_part_of_window", Hyprlang::INT{1});
|
||||||
|
|
Loading…
Reference in a new issue