Skip to content

Commit

Permalink
ipc: use XDG_RUNTIME_DIR if available
Browse files Browse the repository at this point in the history
fixes #169
  • Loading branch information
vaxerski committed May 4, 2024
1 parent d50f0ed commit 03cd362
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ipc/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down

0 comments on commit 03cd362

Please sign in to comment.