summaryrefslogtreecommitdiff
path: root/src/debug/HyprCtl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug/HyprCtl.cpp')
-rw-r--r--src/debug/HyprCtl.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index d4b765e2..bef7c68e 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -536,6 +536,29 @@ std::string animationsRequest(HyprCtl::eHyprCtlOutputFormat format) {
return ret;
}
+std::string globalShortcutsRequest(HyprCtl::eHyprCtlOutputFormat format) {
+ std::string ret = "";
+ const auto SHORTCUTS = g_pProtocolManager->m_pGlobalShortcutsProtocolManager->getAllShortcuts();
+ if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
+ for (auto& sh : SHORTCUTS)
+ ret += getFormat("%s:%s -> %s\n", sh.appid.c_str(), sh.id.c_str(), sh.description.c_str());
+ } else {
+ ret += "[";
+ for (auto& sh : SHORTCUTS) {
+ ret += getFormat(R"#(
+{
+ "name": "%s",
+ "description": "%s"
+},)#",
+ escapeJSONStrings(sh.appid + ":" + sh.id).c_str(), escapeJSONStrings(sh.description).c_str());
+ }
+ ret.pop_back();
+ ret += "]\n";
+ }
+
+ return ret;
+}
+
std::string bindsRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string ret = "";
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
@@ -1228,6 +1251,8 @@ std::string getReply(std::string request) {
return cursorPosRequest(format);
else if (request == "binds")
return bindsRequest(format);
+ else if (request == "globalshortcuts")
+ return globalShortcutsRequest(format);
else if (request == "animations")
return animationsRequest(format);
else if (request.find("plugin") == 0)