summaryrefslogtreecommitdiff
path: root/src/debug/HyprCtl.cpp
diff options
context:
space:
mode:
authorSungyoon Cho <sungyoon@sungyooncho.dev>2024-04-30 22:13:36 +0900
committerGitHub <noreply@github.com>2024-04-30 14:13:36 +0100
commit801437cd540e5ed0b729a68e1e3f59c5bae99bca (patch)
treea3e1d44a72b987c753ef4f170806fd12b7fb55ce /src/debug/HyprCtl.cpp
parent62ae2b3f40ffce99e1d94384800e9eba6638f447 (diff)
hyprctl: add missing json string escapes (#5811)
Diffstat (limited to 'src/debug/HyprCtl.cpp')
-rw-r--r--src/debug/HyprCtl.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 06c6405f..d4e1164a 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -107,9 +107,10 @@ std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) {
"currentFormat": "{}",
"availableModes": [{}]
}},)#",
- m->ID, escapeJSONStrings(m->szName), escapeJSONStrings(m->szShortDescription), (m->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""),
- (m->output->serial ? m->output->serial : ""), (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y,
- m->activeWorkspaceID(), (!m->activeWorkspace ? "" : escapeJSONStrings(m->activeWorkspace->m_szName)), m->activeSpecialWorkspaceID(),
+ m->ID, escapeJSONStrings(m->szName), escapeJSONStrings(m->szShortDescription), escapeJSONStrings(m->output->make ? m->output->make : ""),
+ escapeJSONStrings(m->output->model ? m->output->model : ""), escapeJSONStrings(m->output->serial ? m->output->serial : ""), (int)m->vecPixelSize.x,
+ (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->activeWorkspaceID(),
+ (!m->activeWorkspace ? "" : escapeJSONStrings(m->activeWorkspace->m_szName)), m->activeSpecialWorkspaceID(),
escapeJSONStrings(m->activeSpecialWorkspace ? m->activeSpecialWorkspace->m_szName : ""), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y,
(int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false"),
(m->dpmsStatus ? "true" : "false"), (m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED ? "true" : "false"),
@@ -595,7 +596,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
"address": "0x{:x}",
"name": "{}"
}},)#",
- (uintptr_t)&d, d.name);
+ (uintptr_t)&d, escapeJSONStrings(d.name));
}
trimTrailingComma(result);
@@ -609,7 +610,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
"address": "0x{:x}",
"name": "{}"
}},)#",
- (uintptr_t)&d, d.pWlrDevice ? d.pWlrDevice->name : "");
+ (uintptr_t)&d, escapeJSONStrings(d.pWlrDevice ? d.pWlrDevice->name : ""));
}
trimTrailingComma(result);
@@ -694,8 +695,8 @@ std::string animationsRequest(eHyprCtlOutputFormat format, std::string request)
"speed": {:.2f},
"style": "{}"
}},)#",
- ac.first, ac.second.overridden ? "true" : "false", ac.second.internalBezier, ac.second.internalEnabled ? "true" : "false", ac.second.internalSpeed,
- ac.second.internalStyle);
+ ac.first, ac.second.overridden ? "true" : "false", escapeJSONStrings(ac.second.internalBezier), ac.second.internalEnabled ? "true" : "false",
+ ac.second.internalSpeed, escapeJSONStrings(ac.second.internalStyle));
}
ret[ret.length() - 1] = ']';
@@ -707,7 +708,7 @@ std::string animationsRequest(eHyprCtlOutputFormat format, std::string request)
{{
"name": "{}"
}},)#",
- bz.first);
+ escapeJSONStrings(bz.first));
}
trimTrailingComma(ret);