aboutsummaryrefslogtreecommitdiffhomepage
path: root/hyprctl
diff options
context:
space:
mode:
authorbazuin-32 <[email protected]>2022-07-12 16:34:28 -0600
committerbazuin-32 <[email protected]>2022-07-12 16:34:28 -0600
commitab859ec9fcd749f3f898684710085ff8dc1303d4 (patch)
treef49924833d4be4de9359f86bb8438b180acc78ad /hyprctl
parentac9ff795cdfd25c37b9b9be44f3d034bfa3284d3 (diff)
downloadHyprland-ab859ec9fcd749f3f898684710085ff8dc1303d4.tar.gz
Hyprland-ab859ec9fcd749f3f898684710085ff8dc1303d4.zip
Fix issues with batch requests
Diffstat (limited to 'hyprctl')
-rw-r--r--hyprctl/main.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp
index b2c00ce7..0f30e588 100644
--- a/hyprctl/main.cpp
+++ b/hyprctl/main.cpp
@@ -186,8 +186,8 @@ void hyprpaperRequest(int argc, char** argv) {
requestHyprpaper(rq);
}
-void batchRequest(int argc, char** argv) {
- std::string rq = "[[BATCH]]" + std::string(argv[2]);
+void batchRequest(std::string arg) {
+ std::string rq = "[[BATCH]]" + arg.substr(arg.find_first_of(" ") + 1);
request(rq);
}
@@ -200,13 +200,18 @@ int main(int argc, char** argv) {
return 1;
}
- std::string fullRequest = argv[1];
+ std::string fullRequest = "";
+ for (int i = 1; i < argc; i++) {
+ fullRequest += std::string(argv[i]) + " ";
+ }
+ fullRequest.pop_back(); // remove trailing space
- if (!fullRequest.contains("/")) {
+ if (!std::string(argv[1]).contains("/")) {
fullRequest = "/" + fullRequest;
}
- if (fullRequest.contains("/monitors")) request(fullRequest);
+ if (fullRequest.contains("/--batch")) batchRequest(fullRequest);
+ else if (fullRequest.contains("/monitors")) request(fullRequest);
else if (fullRequest.contains("/clients")) request(fullRequest);
else if (fullRequest.contains("/workspaces")) request(fullRequest);
else if (fullRequest.contains("/activewindow")) request(fullRequest);
@@ -219,7 +224,6 @@ int main(int argc, char** argv) {
else if (fullRequest.contains("/dispatch")) dispatchRequest(argc, argv);
else if (fullRequest.contains("/keyword")) keywordRequest(argc, argv);
else if (fullRequest.contains("/hyprpaper")) hyprpaperRequest(argc, argv);
- else if (fullRequest.contains("/--batch")) batchRequest(argc, argv);
else if (fullRequest.contains("/--help")) printf("%s", USAGE.c_str());
else {
printf("%s\n", USAGE.c_str());