mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-22 10:35:58 +01:00
parent
ed16998aad
commit
8018a2f817
3 changed files with 10 additions and 5 deletions
|
@ -36,6 +36,8 @@ plugin {
|
||||||
|
|
||||||
`bar_part_of_window` -> (bool) whether the bar is a part of the main window (if it is, stuff like shadows render around it)
|
`bar_part_of_window` -> (bool) whether the bar is a part of the main window (if it is, stuff like shadows render around it)
|
||||||
|
|
||||||
|
`bar_precedence_over_border` -> (bool) whether the bar should have a higher priority than the border (border will be around the bar)
|
||||||
|
|
||||||
## Buttons Config
|
## Buttons Config
|
||||||
|
|
||||||
Use the `hyprbars-button` keyword.
|
Use the `hyprbars-button` keyword.
|
||||||
|
|
|
@ -31,11 +31,12 @@ CHyprBar::~CHyprBar() {
|
||||||
|
|
||||||
SDecorationPositioningInfo CHyprBar::getPositioningInfo() {
|
SDecorationPositioningInfo CHyprBar::getPositioningInfo() {
|
||||||
static auto* const PHEIGHT = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_height")->intValue;
|
static auto* const PHEIGHT = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_height")->intValue;
|
||||||
|
static auto* const PPRECEDENCE = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_precedence_over_border")->intValue;
|
||||||
|
|
||||||
SDecorationPositioningInfo info;
|
SDecorationPositioningInfo info;
|
||||||
info.policy = DECORATION_POSITION_STICKY;
|
info.policy = DECORATION_POSITION_STICKY;
|
||||||
info.edges = DECORATION_EDGE_TOP;
|
info.edges = DECORATION_EDGE_TOP;
|
||||||
info.priority = 1000;
|
info.priority = *PPRECEDENCE ? 10005 : 5000;
|
||||||
info.reserved = true;
|
info.reserved = true;
|
||||||
info.desiredExtents = {{0, *PHEIGHT}, {0, 0}};
|
info.desiredExtents = {{0, *PHEIGHT}, {0, 0}};
|
||||||
return info;
|
return info;
|
||||||
|
@ -353,6 +354,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
|
|
||||||
static auto* const PCOLOR = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_color")->intValue;
|
static auto* const PCOLOR = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_color")->intValue;
|
||||||
static auto* const PHEIGHT = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_height")->intValue;
|
static auto* const PHEIGHT = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_height")->intValue;
|
||||||
|
static auto* const PPRECEDENCE = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_precedence_over_border")->intValue;
|
||||||
|
|
||||||
if (*PHEIGHT < 1) {
|
if (*PHEIGHT < 1) {
|
||||||
m_iLastHeight = *PHEIGHT;
|
m_iLastHeight = *PHEIGHT;
|
||||||
|
@ -362,7 +364,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
|
||||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();
|
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();
|
||||||
|
|
||||||
const auto ROUNDING = m_pWindow->rounding() + m_pWindow->getRealBorderSize();
|
const auto ROUNDING = m_pWindow->rounding() + (*PPRECEDENCE ? 0 : m_pWindow->getRealBorderSize());
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_font", SConfigValue{.strValue = "Sans"});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_font", SConfigValue{.strValue = "Sans"});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_align", SConfigValue{.strValue = "center"});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_align", SConfigValue{.strValue = "center"});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_part_of_window", SConfigValue{.intValue = 1});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_part_of_window", SConfigValue{.intValue = 1});
|
||||||
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_precedence_over_border", SConfigValue{.intValue = 0});
|
||||||
|
|
||||||
HyprlandAPI::addConfigKeyword(PHANDLE, "hyprbars-button", [&](const std::string& k, const std::string& v) { onNewButton(k, v); });
|
HyprlandAPI::addConfigKeyword(PHANDLE, "hyprbars-button", [&](const std::string& k, const std::string& v) { onNewButton(k, v); });
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "preConfigReload", [&](void* self, SCallbackInfo& info, std::any data) { onPreConfigReload(); });
|
HyprlandAPI::registerCallbackDynamic(PHANDLE, "preConfigReload", [&](void* self, SCallbackInfo& info, std::any data) { onPreConfigReload(); });
|
||||||
|
|
Loading…
Reference in a new issue