aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/debug
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2024-09-24 11:25:05 +0100
committervaxerski <[email protected]>2024-09-24 11:25:05 +0100
commit00c862686354d139a53222d41a1c80d698a50c43 (patch)
treec19b7739a03b98f83890268ef250558b1bad28ff /src/debug
parent0a211f29f5952322925b9f982cbf9b0326d45f0f (diff)
downloadHyprland-00c862686354d139a53222d41a1c80d698a50c43.tar.gz
Hyprland-00c862686354d139a53222d41a1c80d698a50c43.zip
hyprctl: add submap request
fixes #7898
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/HyprCtl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 4de9143d..87e071d7 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -1627,6 +1627,14 @@ std::string getDescriptions(eHyprCtlOutputFormat format, std::string request) {
return json;
}
+std::string submapRequest(eHyprCtlOutputFormat format, std::string request) {
+ std::string submap = g_pKeybindManager->getCurrentSubmap();
+ if (submap.empty())
+ submap = "default";
+
+ return format == FORMAT_JSON ? std::format("{{\"{}\"}}\n", escapeJSONStrings(submap)) : (submap + "\n");
+}
+
CHyprCtl::CHyprCtl() {
registerCommand(SHyprCtlCommand{"workspaces", true, workspacesRequest});
registerCommand(SHyprCtlCommand{"workspacerules", true, workspaceRulesRequest});
@@ -1648,6 +1656,7 @@ CHyprCtl::CHyprCtl() {
registerCommand(SHyprCtlCommand{"configerrors", true, configErrorsRequest});
registerCommand(SHyprCtlCommand{"locked", true, getIsLocked});
registerCommand(SHyprCtlCommand{"descriptions", true, getDescriptions});
+ registerCommand(SHyprCtlCommand{"submap", true, submapRequest});
registerCommand(SHyprCtlCommand{"monitors", false, monitorsRequest});
registerCommand(SHyprCtlCommand{"reload", false, reloadRequest});