summaryrefslogtreecommitdiff
path: root/src/debug/HyprCtl.cpp
diff options
context:
space:
mode:
authorJohn Berg <john.berg.96bits@gmail.com>2026-03-22 23:24:15 +0000
committerGitHub <noreply@github.com>2026-03-22 23:24:15 +0000
commitc8b283f5ac8c370794605d61f2d1af27c6018dd9 (patch)
tree095faab284831362bcda5f1099ea3c33663b5a0a /src/debug/HyprCtl.cpp
parentc54d7bf647b211192b9c4519b12c47e8f598fdbf (diff)
hyprctl: fix json output for the submap command (#13726)
The output of ``hyprctl submap -j`` returns a string contained within curly braces e.g. ``{"default"}``. But this is not valid JSON as-per RFC-7159, as an object must be a set of name/value pairs. As a result, tools such as jq do not accept the current output. This patch is a simple fix is to drop the braces and return the string describing the current submap. The new JSON formatting is accepted by jq. This would be a breaking change for anything which consumes the current output of the submap command, but since parsers reject this (and since the output is pretty simple to parse without using the -j flag) impact might be more limited. Signed-off-by: John Berg <john.berg.96bits@gmail.com>
Diffstat (limited to 'src/debug/HyprCtl.cpp')
-rw-r--r--src/debug/HyprCtl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index f113325f..9a09016f 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -2056,7 +2056,7 @@ static std::string submapRequest(eHyprCtlOutputFormat format, std::string reques
if (submap.empty())
submap = "default";
- return format == FORMAT_JSON ? std::format("{{\"{}\"}}\n", escapeJSONStrings(submap)) : (submap + "\n");
+ return format == FORMAT_JSON ? std::format("\"{}\"\n", escapeJSONStrings(submap)) : (submap + "\n");
}
static std::string reloadShaders(eHyprCtlOutputFormat format, std::string request) {