From 5a750b485aca8b2fd5545cfe86b3a48c69355d65 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 5 Nov 2022 18:04:44 +0000 Subject: Added creating / destroying outputs on a multi-backend + headless backend See `hyprctl output`. --- hyprctl/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'hyprctl/main.cpp') diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp index f4de085f..edae83e1 100644 --- a/hyprctl/main.cpp +++ b/hyprctl/main.cpp @@ -217,6 +217,21 @@ int setcursorRequest(int argc, char** argv) { return 0; } +int outputRequest(int argc, char** argv) { + if (argc < 4) { + std::cout << "Usage: hyprctl output \n\ + creates / destroys a fake output\n\ + with create, name is the backend name to use (available: auto, x11, wayland, headless)\n\ + with destroy, name is the output name to destroy"; + return 1; + } + + std::string rq = "output " + std::string(argv[2]) + " " + std::string(argv[3]); + + request(rq); + return 0; +} + void batchRequest(std::string arg) { std::string rq = "[[BATCH]]" + arg.substr(arg.find_first_of(" ") + 1); @@ -290,6 +305,7 @@ int main(int argc, char** argv) { else if (fullRequest.contains("/reload")) request(fullRequest); else if (fullRequest.contains("/getoption")) request(fullRequest); else if (fullRequest.contains("/cursorpos")) request(fullRequest); + else if (fullRequest.contains("/output")) exitStatus = outputRequest(argc, argv); else if (fullRequest.contains("/setcursor")) exitStatus = setcursorRequest(argc, argv); else if (fullRequest.contains("/dispatch")) exitStatus = dispatchRequest(argc, argv); else if (fullRequest.contains("/keyword")) exitStatus = keywordRequest(argc, argv); -- cgit v1.2.3