summaryrefslogtreecommitdiff
path: root/hyprctl/main.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-21 16:11:29 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-21 16:11:29 +0200
commitc02afa0c2725b353c56706fa0186143f661cc283 (patch)
treed862d48e2b3ac00fb0d11212ce0939df8f846d9c /hyprctl/main.cpp
parent422eaad4201fe1902f037898e98d8651925b9c13 (diff)
Added hyprctl dispatch
Diffstat (limited to 'hyprctl/main.cpp')
-rw-r--r--hyprctl/main.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp
index 9868febf..0382901a 100644
--- a/hyprctl/main.cpp
+++ b/hyprctl/main.cpp
@@ -22,6 +22,7 @@ usage: hyprctl [command] [(opt)args]
clients
activewindow
layers
+ dispatch
)#";
void request(std::string arg) {
@@ -96,6 +97,18 @@ void request(std::string arg) {
std::cout << std::string(buffer);
}
+void dispatchRequest(int argc, char** argv) {
+
+ if (argc < 4) {
+ std::cout << "dispatch requires 2 params";
+ return;
+ }
+
+ std::string rq = "dispatch " + std::string(argv[2]) + " " + std::string(argv[3]);
+
+ request(rq);
+}
+
int main(int argc, char** argv) {
int bflag = 0, sflag = 0, index, c;
@@ -109,6 +122,7 @@ int main(int argc, char** argv) {
else if (!strcmp(argv[1], "workspaces")) request("workspaces");
else if (!strcmp(argv[1], "activewindow")) request("activewindow");
else if (!strcmp(argv[1], "layers")) request("layers");
+ else if (!strcmp(argv[1], "dispatch")) dispatchRequest(argc, argv);
else {
printf(USAGE.c_str());
return 1;