diff options
| author | bazuin-32 <ameenpiano@gmail.com> | 2022-07-12 16:34:28 -0600 |
|---|---|---|
| committer | bazuin-32 <ameenpiano@gmail.com> | 2022-07-12 16:34:28 -0600 |
| commit | ab859ec9fcd749f3f898684710085ff8dc1303d4 (patch) | |
| tree | f49924833d4be4de9359f86bb8438b180acc78ad /src/debug/HyprCtl.cpp | |
| parent | ac9ff795cdfd25c37b9b9be44f3d034bfa3284d3 (diff) | |
Fix issues with batch requests
Diffstat (limited to 'src/debug/HyprCtl.cpp')
| -rw-r--r-- | src/debug/HyprCtl.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 684bca9c..ab72d86e 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -513,22 +513,24 @@ std::string dispatchBatch(std::string request) { std::string getReply(std::string request) { auto format = HyprCtl::FORMAT_NORMAL; - // process flags - int sepIndex = 0; - for (const auto& c : request) { - if (c == '/') { // stop at separator - break; + // process flags for non-batch requests + if (!(request.find("[[BATCH]]") == 0)) { + int sepIndex = 0; + for (const auto& c : request) { + if (c == '/') { // stop at separator + break; + } + + sepIndex++; + + if (c == 'j') + format = HyprCtl::FORMAT_JSON; } - sepIndex++; - - if (c == 'j') - format = HyprCtl::FORMAT_JSON; + if (sepIndex < request.size()) + request = request.substr(sepIndex + 1); // remove flags and separator so we can compare the rest of the string } - if (sepIndex < request.size()) - request = request.substr(sepIndex + 1); // remove flags and separator so we can compare the rest of the string - if (request == "monitors") return monitorsRequest(format); else if (request == "workspaces") |
