diff options
| author | Vaxry <vaxry@vaxry.net> | 2024-03-04 10:36:32 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2024-03-04 10:36:38 +0000 |
| commit | 12da0fc84f8b084f7b13702b811cbed7dae9854c (patch) | |
| tree | a4e0ed427418847faeef39f1cb0c8e17a16e6c38 /src/debug/HyprCtl.cpp | |
| parent | 9d89b7109da9b58904caf7c53a7af4b6daed1696 (diff) | |
hyprctl: parse custom types in getoption
Diffstat (limited to 'src/debug/HyprCtl.cpp')
| -rw-r--r-- | src/debug/HyprCtl.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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<Hyprlang::VEC2>(VAL).x, std::any_cast<Hyprlang::VEC2>(VAL).y, VAR->m_bSetByUser); else if (TYPE == typeid(Hyprlang::STRING)) return std::format("str: {}\nset: {}", std::any_cast<Hyprlang::STRING>(VAL), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*)) - return std::format("custom type at: {:x}\nset: {}", (uintptr_t)std::any_cast<Hyprlang::CUSTOMTYPE*>(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(void*)) + return std::format("custom type: {}\nset: {}", ((ICustomConfigValueData*)std::any_cast<void*>(VAL))->toString(), VAR->m_bSetByUser); } else { if (TYPE == typeid(Hyprlang::INT)) return std::format("{{\"option\": \"{}\", \"int\": {}, \"set\": {} }}", curitem, std::any_cast<Hyprlang::INT>(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<Hyprlang::STRING>(VAL)), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*)) - return std::format("{{\"option\": \"{}\", \"custom\": \"{:x}\", \"set\": {} }}", curitem, (uintptr_t)std::any_cast<Hyprlang::CUSTOMTYPE*>(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(void*)) + return std::format("{{\"option\": \"{}\", \"custom\": \"{}\", \"set\": {} }}", curitem, ((ICustomConfigValueData*)std::any_cast<void*>(VAL))->toString(), + VAR->m_bSetByUser); } return "invalid type (internal error)"; |
