diff options
author | vaxerski <[email protected]> | 2024-09-24 11:25:05 +0100 |
---|---|---|
committer | vaxerski <[email protected]> | 2024-09-24 11:25:05 +0100 |
commit | 00c862686354d139a53222d41a1c80d698a50c43 (patch) | |
tree | c19b7739a03b98f83890268ef250558b1bad28ff /src/debug | |
parent | 0a211f29f5952322925b9f982cbf9b0326d45f0f (diff) | |
download | Hyprland-00c862686354d139a53222d41a1c80d698a50c43.tar.gz Hyprland-00c862686354d139a53222d41a1c80d698a50c43.zip |
hyprctl: add submap request
fixes #7898
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/HyprCtl.cpp | 9 |
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}); |