summaryrefslogtreecommitdiff
path: root/hyprctl
diff options
context:
space:
mode:
authorAaron Tulino <13600347+aaronjamt@users.noreply.github.com>2025-01-31 05:33:36 -0700
committerGitHub <noreply@github.com>2025-01-31 13:33:36 +0100
commit7d51dee103e22742d425d14faebb0273a64ac8c1 (patch)
tree7b0483d858e90626015fa1b484b52c9bc6cc261e /hyprctl
parentea16b64ec169afcd21020dfb819a73c37428c7f2 (diff)
hyprctl: Extract IPC code to separate method (#9223)
This makes it possible to use the same IPC code for more projects in the future
Diffstat (limited to 'hyprctl')
-rw-r--r--hyprctl/main.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp
index 4cc73bdf..ac88f1da 100644
--- a/hyprctl/main.cpp
+++ b/hyprctl/main.cpp
@@ -225,7 +225,7 @@ int request(std::string arg, int minArgs = 0, bool needRoll = false) {
return 0;
}
-int requestHyprpaper(std::string arg) {
+int requestIPC(std::string filename, std::string arg) {
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
if (SERVERSOCKET < 0) {
@@ -243,7 +243,7 @@ int requestHyprpaper(std::string arg) {
const std::string USERID = std::to_string(getUID());
- std::string socketPath = getRuntimeDir() + "/" + instanceSignature + "/.hyprpaper.sock";
+ std::string socketPath = getRuntimeDir() + "/" + instanceSignature + "/" + filename;
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
@@ -278,6 +278,10 @@ int requestHyprpaper(std::string arg) {
return 0;
}
+int requestHyprpaper(std::string arg) {
+ return requestIPC(".hyprpaper.sock", arg);
+}
+
void batchRequest(std::string arg, bool json) {
std::string commands = arg.substr(arg.find_first_of(' ') + 1);