diff --git a/src/Window.cpp b/src/Window.cpp index eacce1e1..7e7dce52 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -477,6 +477,10 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { try { m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)); } catch (std::exception& e) { Debug::log(ERR, "Rounding rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); } + } else if (r.szRule.find("bordersize") == 0) { + try { + m_sAdditionalConfigData.borderSize = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)); + } catch (std::exception& e) { Debug::log(ERR, "Bordersize rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); } } else if (r.szRule.find("opacity") == 0) { try { CVarList vars(r.szRule, 0, ' '); @@ -536,6 +540,7 @@ void CWindow::updateDynamicRules() { m_sAdditionalConfigData.rounding = -1; m_sAdditionalConfigData.dimAround = false; m_sAdditionalConfigData.forceRGBX = false; + m_sAdditionalConfigData.borderSize = -1; const auto WINDOWRULES = g_pConfigManager->getMatchingRules(this); for (auto& r : WINDOWRULES) { diff --git a/src/Window.hpp b/src/Window.hpp index 3bb00f00..b2260d6e 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -122,6 +122,7 @@ struct SWindowAdditionalConfigData { CWindowOverridableVar noMaxSize = false; CWindowOverridableVar dimAround = false; CWindowOverridableVar forceRGBX = false; + CWindowOverridableVar borderSize = -1; // -1 means unset, takes precedence over the renderdata one }; struct SWindowRule { diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 27ecf58a..c61bd15c 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -880,7 +880,7 @@ bool windowRuleValid(const std::string& RULE) { RULE != "noshadow" && RULE != "nodim" && RULE != "noborder" && RULE != "center" && RULE != "opaque" && RULE != "forceinput" && RULE != "fullscreen" && RULE != "nofullscreenrequest" && RULE != "fakefullscreen" && RULE != "nomaxsize" && RULE != "pin" && RULE != "noanim" && RULE != "dimaround" && RULE != "windowdance" && RULE != "maximize" && RULE.find("animation") != 0 && RULE.find("rounding") != 0 && RULE.find("workspace") != 0 && - RULE.find("bordercolor") != 0 && RULE != "forcergbx" && RULE != "noinitialfocus" && RULE != "stayfocused"); + RULE.find("bordercolor") != 0 && RULE != "forcergbx" && RULE != "noinitialfocus" && RULE != "stayfocused" && RULE.find("bordersize") != 0); } bool layerRuleValid(const std::string& RULE) { diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 604758bc..c1b33bd5 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -127,6 +127,8 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT); auto borderSize = PWINDOW->m_sSpecialRenderData.borderSize.toUnderlying() != -1 ? PWINDOW->m_sSpecialRenderData.borderSize.toUnderlying() : WORKSPACERULE.borderSize.value_or(*PBORDERSIZE); + if (PWINDOW->m_sAdditionalConfigData.borderSize.toUnderlying() != -1) + borderSize = PWINDOW->m_sAdditionalConfigData.borderSize.toUnderlying(); if (!g_pCompositor->windowExists(PWINDOW) || !PWINDOW->m_bIsMapped) { Debug::log(ERR, "Node %lx holding invalid window %lx!!", pNode, PWINDOW); diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index e0000914..5a9d252e 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -294,7 +294,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) { if ((WINDOWS < 2) && !centerMasterWindow) { PMASTERNODE->position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition; PMASTERNODE->size = Vector2D(PMONITOR->vecSize.x - PMONITOR->vecReservedTopLeft.x - PMONITOR->vecReservedBottomRight.x, - PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y); + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y); applyNodeDataToWindow(PMASTERNODE); return; } else if (orientation == ORIENTATION_LEFT || orientation == ORIENTATION_RIGHT || (orientation == ORIENTATION_CENTER && STACKWINDOWS <= 1)) { @@ -515,6 +515,8 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT); auto borderSize = PWINDOW->m_sSpecialRenderData.borderSize.toUnderlying() != -1 ? PWINDOW->m_sSpecialRenderData.borderSize.toUnderlying() : WORKSPACERULE.borderSize.value_or(*PBORDERSIZE); + if (PWINDOW->m_sAdditionalConfigData.borderSize.toUnderlying() != -1) + borderSize = PWINDOW->m_sAdditionalConfigData.borderSize.toUnderlying(); if (!g_pCompositor->windowValidMapped(PWINDOW)) { Debug::log(ERR, "Node %lx holding invalid window %lx!!", pNode, PWINDOW); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 59f935b1..f6a7132d 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -357,13 +357,15 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* scaleBox(&windowBox, pMonitor->scale); - const int BORDERSIZE = pWindow->m_sSpecialRenderData.borderSize.toUnderlying() == -1 ? *PBORDERSIZE : pWindow->m_sSpecialRenderData.borderSize.toUnderlying(); + int borderSize = pWindow->m_sSpecialRenderData.borderSize.toUnderlying() == -1 ? *PBORDERSIZE : pWindow->m_sSpecialRenderData.borderSize.toUnderlying(); + if (pWindow->m_sAdditionalConfigData.borderSize.toUnderlying() != -1) + borderSize = pWindow->m_sAdditionalConfigData.borderSize.toUnderlying(); - g_pHyprOpenGL->renderBorder(&windowBox, grad, rounding, BORDERSIZE, a1); + g_pHyprOpenGL->renderBorder(&windowBox, grad, rounding, borderSize, a1); if (ANIMATED) { float a2 = renderdata.fadeAlpha * renderdata.alpha * (1.f - g_pHyprOpenGL->m_pCurrentWindow->m_fBorderFadeAnimationProgress.fl()); - g_pHyprOpenGL->renderBorder(&windowBox, g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColorPrevious, rounding, BORDERSIZE, a2); + g_pHyprOpenGL->renderBorder(&windowBox, g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColorPrevious, rounding, borderSize, a2); } } }