diff --git a/src/config/ConfigDataValues.hpp b/src/config/ConfigDataValues.hpp index accc92ab..39c60a5a 100644 --- a/src/config/ConfigDataValues.hpp +++ b/src/config/ConfigDataValues.hpp @@ -14,6 +14,8 @@ class ICustomConfigValueData { virtual ~ICustomConfigValueData() = 0; virtual eConfigValueDataTypes getDataType() = 0; + + virtual std::string toString() = 0; }; class CGradientValueData : public ICustomConfigValueData { @@ -51,6 +53,15 @@ class CGradientValueData : public ICustomConfigValueData { return true; } + + virtual std::string toString() { + std::string result; + for (auto& c : m_vColors) { + result += std::format("{:x} ", c.getAsHex()); + } + + result += std::format("{}deg", (int)(m_fAngle * 180.0 / M_PI)); + } }; class CCssGapData : public ICustomConfigValueData { @@ -103,4 +114,8 @@ class CCssGapData : public ICustomConfigValueData { virtual eConfigValueDataTypes getDataType() { return CVD_TYPE_CSS_VALUE; } + + virtual std::string toString() { + return std::format("{} {} {} {}", top, right, bottom, left); + } }; diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index acc399b6..f2e4869a 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1225,8 +1225,8 @@ std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string request) return std::format("vec2: [{}, {}]\nset: {}", std::any_cast(VAL).x, std::any_cast(VAL).y, VAR->m_bSetByUser); else if (TYPE == typeid(Hyprlang::STRING)) return std::format("str: {}\nset: {}", std::any_cast(VAL), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*)) - return std::format("custom type at: {:x}\nset: {}", (uintptr_t)std::any_cast(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(void*)) + return std::format("custom type: {}\nset: {}", ((ICustomConfigValueData*)std::any_cast(VAL))->toString(), VAR->m_bSetByUser); } else { if (TYPE == typeid(Hyprlang::INT)) return std::format("{{\"option\": \"{}\", \"int\": {}, \"set\": {} }}", curitem, std::any_cast(VAL), VAR->m_bSetByUser); @@ -1237,8 +1237,9 @@ std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string request) VAR->m_bSetByUser); else if (TYPE == typeid(Hyprlang::STRING)) return std::format("{{\"option\": \"{}\", \"str\": \"{}\", \"set\": {} }}", curitem, escapeJSONStrings(std::any_cast(VAL)), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*)) - return std::format("{{\"option\": \"{}\", \"custom\": \"{:x}\", \"set\": {} }}", curitem, (uintptr_t)std::any_cast(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(void*)) + return std::format("{{\"option\": \"{}\", \"custom\": \"{}\", \"set\": {} }}", curitem, ((ICustomConfigValueData*)std::any_cast(VAL))->toString(), + VAR->m_bSetByUser); } return "invalid type (internal error)";