From 03cd362f494d6771b4f524f4fafbc28bade00c8e Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 4 May 2024 22:01:40 +0100 Subject: [PATCH] ipc: use XDG_RUNTIME_DIR if available fixes #169 --- src/ipc/Socket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ipc/Socket.cpp b/src/ipc/Socket.cpp index 26ba86c..d868273 100644 --- a/src/ipc/Socket.cpp +++ b/src/ipc/Socket.cpp @@ -25,9 +25,10 @@ void CIPCSocket::initialize() { sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX}; const auto HISenv = getenv("HYPRLAND_INSTANCE_SIGNATURE"); + const auto RUNTIMEdir = getenv("XDG_RUNTIME_DIR"); const std::string USERID = std::to_string(getpwuid(getuid())->pw_uid); - const auto USERDIR = "/run/user/" + USERID + "/hypr/"; + const auto USERDIR = RUNTIMEdir ? RUNTIMEdir + std::string{"/hypr/"} : "/run/user/" + USERID + "/hypr/"; std::string socketPath = HISenv ? USERDIR + std::string(HISenv) + "/.hyprpaper.sock" : USERDIR + ".hyprpaper.sock";