summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/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 /hyprtester/src/tests/main/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 'hyprtester/src/tests/main/hyprctl.cpp')
-rw-r--r--hyprtester/src/tests/main/hyprctl.cpp8
1 files changed, 8 insertions, 0 deletions
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;