summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-08-06 16:28:07 +0200
committerGitHub <noreply@github.com>2025-08-06 16:28:07 +0200
commitec26b753a253bf92ad7451b685b95cbddcb75403 (patch)
tree2b702ff3aab2b5158c2c45b9184f0859681cbf43 /src
parent0c317f25080972c949139460e1e6c8a63daaf05a (diff)
descriptions: fix bad json output (#11350)
--------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp8
-rw-r--r--src/debug/HyprCtl.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 337682dc..48c1d103 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -3210,8 +3210,8 @@ std::string SConfigOptionDescription::jsonify() const {
"explicit": {})#",
val.value, val.min, val.max, currentValue, EXPLICIT);
} else if constexpr (std::is_same_v<T, SColorData>) {
- return std::format(R"#( "value": {},
- "current": {},
+ return std::format(R"#( "value": "{}",
+ "current": "{}",
"explicit": {})#",
val.color.getAsHex(), currentValue, EXPLICIT);
} else if constexpr (std::is_same_v<T, SBoolData>) {
@@ -3220,7 +3220,7 @@ std::string SConfigOptionDescription::jsonify() const {
"explicit": {})#",
val.value, currentValue, EXPLICIT);
} else if constexpr (std::is_same_v<T, SChoiceData>) {
- return std::format(R"#( "value": {},
+ return std::format(R"#( "value": "{}",
"firstIndex": {},
"current": {},
"explicit": {})#",
@@ -3257,7 +3257,7 @@ std::string SConfigOptionDescription::jsonify() const {
{}
}}
}})#",
- value, description, (uint16_t)type, (uint32_t)flags, parseData());
+ value, escapeJSONStrings(description), (uint16_t)type, (uint32_t)flags, parseData());
return json;
}
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index cec41087..3b83d323 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -1697,7 +1697,7 @@ static std::string getIsLocked(eHyprCtlOutputFormat format, std::string request)
}
static std::string getDescriptions(eHyprCtlOutputFormat format, std::string request) {
- std::string json = "{";
+ std::string json = "[";
const auto& DESCS = g_pConfigManager->getAllDescriptions();
for (const auto& d : DESCS) {
@@ -1707,7 +1707,7 @@ static std::string getDescriptions(eHyprCtlOutputFormat format, std::string requ
json.pop_back();
json.pop_back();
- json += "}\n";
+ json += "]\n";
return json;
}