From c8b283f5ac8c370794605d61f2d1af27c6018dd9 Mon Sep 17 00:00:00 2001 From: John Berg Date: Sun, 22 Mar 2026 23:24:15 +0000 Subject: 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 --- src/debug/HyprCtl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/debug/HyprCtl.cpp') 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) { -- cgit v1.2.3