diff options
author | minus <minus@mnus.de> | 2015-08-19 01:40:49 +0200 |
---|---|---|
committer | minus <minus@mnus.de> | 2015-08-20 15:24:33 +0200 |
commit | bfbadadf702c6c7f078cc2e854afa02686b91c22 (patch) | |
tree | 8fb7e794e913acd4721ca3e9ce971debe36de7f2 | |
parent | 773e85c681ee4faecf353de7066b536f1a50ff61 (diff) | |
download | sway-bfbadadf702c6c7f078cc2e854afa02686b91c22.tar.xz |
use env var SWAYSOCK if available
or fall back to /tmp/sway-ipc.sock
-rw-r--r-- | sway/ipc.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -40,10 +40,13 @@ void init_ipc() { struct sockaddr_un ipc_sockaddr = { .sun_family = AF_UNIX, - // TODO: use a proper socket path - .sun_path = "/tmp/sway.sock" + .sun_path = "/tmp/sway-ipc.sock" }; + if (getenv("SWAYSOCK") != NULL) { + strncpy(ipc_sockaddr.sun_path, getenv("SWAYSOCK"), sizeof(ipc_sockaddr.sun_path)); + } + unlink(ipc_sockaddr.sun_path); if (bind(ipc_socket, (struct sockaddr *)&ipc_sockaddr, sizeof(ipc_sockaddr)) == -1) { sway_abort("Unable to bind IPC socket"); |