summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar minus <minus@mnus.de>2015-08-19 01:40:49 +0200
committerLibravatar minus <minus@mnus.de>2015-08-20 15:24:33 +0200
commitbfbadadf702c6c7f078cc2e854afa02686b91c22 (patch)
tree8fb7e794e913acd4721ca3e9ce971debe36de7f2
parentproperly handle IPC clients (diff)
downloadsway-bfbadadf702c6c7f078cc2e854afa02686b91c22.tar.gz
sway-bfbadadf702c6c7f078cc2e854afa02686b91c22.tar.zst
sway-bfbadadf702c6c7f078cc2e854afa02686b91c22.zip
use env var SWAYSOCK if available
or fall back to /tmp/sway-ipc.sock
-rw-r--r--sway/ipc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sway/ipc.c b/sway/ipc.c
index 292d9593..ba01a679 100644
--- a/sway/ipc.c
+++ b/sway/ipc.c
@@ -40,10 +40,13 @@ void init_ipc() {
40 40
41 struct sockaddr_un ipc_sockaddr = { 41 struct sockaddr_un ipc_sockaddr = {
42 .sun_family = AF_UNIX, 42 .sun_family = AF_UNIX,
43 // TODO: use a proper socket path 43 .sun_path = "/tmp/sway-ipc.sock"
44 .sun_path = "/tmp/sway.sock"
45 }; 44 };
46 45
46 if (getenv("SWAYSOCK") != NULL) {
47 strncpy(ipc_sockaddr.sun_path, getenv("SWAYSOCK"), sizeof(ipc_sockaddr.sun_path));
48 }
49
47 unlink(ipc_sockaddr.sun_path); 50 unlink(ipc_sockaddr.sun_path);
48 if (bind(ipc_socket, (struct sockaddr *)&ipc_sockaddr, sizeof(ipc_sockaddr)) == -1) { 51 if (bind(ipc_socket, (struct sockaddr *)&ipc_sockaddr, sizeof(ipc_sockaddr)) == -1) {
49 sway_abort("Unable to bind IPC socket"); 52 sway_abort("Unable to bind IPC socket");