diff --git a/sway/ipc.c b/sway/ipc.c index 292d9593c..ba01a6790 100644 --- a/sway/ipc.c +++ b/sway/ipc.c @@ -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");