diff options
author | vaxerski <[email protected]> | 2022-06-03 17:41:57 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-06-03 17:41:57 +0200 |
commit | 6f3b004199a6b1bb0a8f5431d677ab926bdf19f3 (patch) | |
tree | 227dec00bfbcefa60cf0ebe7329508f439237c62 /hyprctl | |
parent | 19b17b590c8a2dc19e79542796c7b1b8e65301de (diff) | |
download | Hyprland-6f3b004199a6b1bb0a8f5431d677ab926bdf19f3.tar.gz Hyprland-6f3b004199a6b1bb0a8f5431d677ab926bdf19f3.zip |
IPC and log changes, introduce signature
Diffstat (limited to 'hyprctl')
-rw-r--r-- | hyprctl/main.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp index 60ee9606..d0c7d9ed 100644 --- a/hyprctl/main.cpp +++ b/hyprctl/main.cpp @@ -45,12 +45,25 @@ void request(std::string arg) { return; } + // get the instance signature + auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE"); + + if (!instanceSig) { + std::cout << "HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)"; + return; + } + + std::string instanceSigStr = std::string(instanceSig); + sockaddr_un serverAddress = {0}; serverAddress.sun_family = AF_UNIX; - strcpy(serverAddress.sun_path, "/tmp/hypr/.socket.sock"); + + std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock"; + + strcpy(serverAddress.sun_path, socketPath.c_str()); if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) { - std::cout << "Couldn't connect to /tmp/hypr/.socket.sock. (3) Is Hyprland running?"; + std::cout << "Couldn't connect to " << socketPath << ". (3)"; return; } |