From f50756ba895552933c9ed89ed2177ef34713f91e Mon Sep 17 00:00:00 2001 From: SoSeDiK Date: Tue, 9 Apr 2024 18:14:53 +0300 Subject: [PATCH] props: Parse border color props as gradient (#5513) --- src/debug/HyprCtl.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index ad62de127381..305f52754ab3 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -15,6 +15,7 @@ #include #include +#include "../config/ConfigDataValues.hpp" #include "../config/ConfigValue.hpp" #include "../managers/CursorManager.hpp" #include "../hyprerror/HyprError.hpp" @@ -1213,10 +1214,23 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) { PWINDOW->m_sSpecialRenderData.alphaFullscreenOverride.forceSetIgnoreLocked(configStringToInt(VAL), lock); } else if (PROP == "alphafullscreen") { PWINDOW->m_sSpecialRenderData.alphaFullscreen.forceSetIgnoreLocked(std::stof(VAL), lock); - } else if (PROP == "activebordercolor") { - PWINDOW->m_sSpecialRenderData.activeBorderColor.forceSetIgnoreLocked(CGradientValueData(CColor(configStringToInt(VAL))), lock); - } else if (PROP == "inactivebordercolor") { - PWINDOW->m_sSpecialRenderData.inactiveBorderColor.forceSetIgnoreLocked(CGradientValueData(CColor(configStringToInt(VAL))), lock); + } else if (PROP == "activebordercolor" || PROP == "inactivebordercolor") { + CGradientValueData colorData = {}; + if (vars.size() > 4) { + for (int i = 3; i < static_cast(lock ? vars.size() - 1 : vars.size()); ++i) { + const auto TOKEN = vars[i]; + if (TOKEN.ends_with("deg")) + colorData.m_fAngle = std::stoi(TOKEN.substr(0, TOKEN.size() - 3)) * (PI / 180.0); + else + colorData.m_vColors.push_back(configStringToInt(TOKEN)); + } + } else if (VAL != "-1") + colorData.m_vColors.push_back(configStringToInt(VAL)); + + if (PROP == "activebordercolor") + PWINDOW->m_sSpecialRenderData.activeBorderColor.forceSetIgnoreLocked(colorData, lock); + else + PWINDOW->m_sSpecialRenderData.inactiveBorderColor.forceSetIgnoreLocked(colorData, lock); } else if (PROP == "forcergbx") { PWINDOW->m_sAdditionalConfigData.forceRGBX.forceSetIgnoreLocked(configStringToInt(VAL), lock); } else if (PROP == "bordersize") {