The native Hyprland plugin behind Omarchy's floating workspaces: themed titlebars and edge snapping, built from a hyprbars fork. It is rebuilt with every Hyprland change, since a plugin only loads into the exact build it was compiled against. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
31 lines
1.3 KiB
C++
31 lines
1.3 KiB
C++
#include "BarPassElement.hpp"
|
|
#include <hyprland/src/render/OpenGL.hpp>
|
|
#include <hyprland/src/render/Renderer.hpp>
|
|
#include "barDeco.hpp"
|
|
|
|
using namespace Render::GL;
|
|
|
|
COmarchyFloatingBarPassElement::COmarchyFloatingBarPassElement(const COmarchyFloatingBarPassElement::SBarData &data_) : data(data_) { ; }
|
|
|
|
std::vector<UP<IPassElement>> COmarchyFloatingBarPassElement::draw() {
|
|
data.deco->renderPass(g_pHyprRenderer->m_renderData.pMonitor.lock(), data.a);
|
|
return {};
|
|
}
|
|
|
|
bool COmarchyFloatingBarPassElement::needsLiveBlur() {
|
|
static auto PENABLEBLURGLOBAL = CConfigValue<Config::BOOL>("decoration:blur:enabled");
|
|
|
|
CHyprColor color = data.deco->m_bForcedBarColor.value_or(CHyprColor{static_cast<uint64_t>(g_pOmarchyFloatingGlobalState->config.barColor->value())});
|
|
color.a *= data.a;
|
|
const bool SHOULDBLUR = g_pOmarchyFloatingGlobalState->config.barBlur->value() && *PENABLEBLURGLOBAL && color.a < 1.F;
|
|
|
|
return SHOULDBLUR;
|
|
}
|
|
|
|
std::optional<CBox> COmarchyFloatingBarPassElement::boundingBox() {
|
|
// Temporary fix: expand the bar bb a bit, otherwise occlusion gets too aggressive.
|
|
return data.deco->assignedBoxGlobal().translate(-g_pHyprRenderer->m_renderData.pMonitor->m_position).expand(10);
|
|
}
|
|
|
|
bool COmarchyFloatingBarPassElement::needsPrecomputeBlur() { return false; }
|