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 --- hyprtester/src/tests/main/hyprctl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hyprtester/src/tests/main/hyprctl.cpp') diff --git a/hyprtester/src/tests/main/hyprctl.cpp b/hyprtester/src/tests/main/hyprctl.cpp index e5e6f1fc..4f3fba75 100644 --- a/hyprtester/src/tests/main/hyprctl.cpp +++ b/hyprtester/src/tests/main/hyprctl.cpp @@ -173,6 +173,13 @@ static bool testGetprop() { return true; } +static void testSubmap() { + NLog::log("{}Testing hyprctl submap", Colors::GREEN); + + EXPECT(getCommandStdOut("hyprctl submap"), "default\n"); + EXPECT(getCommandStdOut("hyprctl submap -j | jq -r \".\""), "default"); +} + static bool test() { NLog::log("{}Testing hyprctl", Colors::GREEN); @@ -186,6 +193,7 @@ static bool test() { testGetprop(); testDevicesActiveLayoutIndex(); + testSubmap(); getFromSocket("/reload"); return !ret; -- cgit v1.2.3