diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-21 16:56:27 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-21 16:56:27 +0200 |
| commit | 07080498fd050a6a6660eb68c36d12eb3f87a003 (patch) | |
| tree | fe1c8949b78bce5f97a4e96fd3ec3e277e3d50d7 /src/debug/HyprCtl.cpp | |
| parent | b618fc1caa4063bbed8373935db7e00b2f0cc9fe (diff) | |
Added hyprctl keyword
Diffstat (limited to 'src/debug/HyprCtl.cpp')
| -rw-r--r-- | src/debug/HyprCtl.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 998ea360..21023ef6 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -88,6 +88,22 @@ std::string dispatchRequest(std::string in) { return "ok"; } +std::string dispatchKeyword(std::string in) { + // get rid of the keyword keyword + in = in.substr(in.find_first_of(' ') + 1); + + const auto COMMAND = in.substr(0, in.find_first_of(' ')); + + const auto VALUE = in.substr(in.find_first_of(' ') + 1); + + std::string retval = g_pConfigManager->parseKeyword(COMMAND, VALUE, true); + + if (retval == "") + return "ok"; + + return retval; +} + void HyprCtl::startHyprCtlSocket() { std::thread([&]() { uint16_t connectPort = 9187; @@ -149,6 +165,7 @@ void HyprCtl::startHyprCtlSocket() { else if (request == "activewindow") reply = activeWindowRequest(); else if (request == "layers") reply = layersRequest(); else if (request.find("dispatch") == 0) reply = dispatchRequest(request); + else if (request.find("keyword") == 0) reply = dispatchKeyword(request); } catch (std::exception& e) { Debug::log(ERR, "Error in request: %s", e.what()); reply = "Err: " + std::string(e.what()); |
