diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-13 14:10:00 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-13 14:10:00 -0500 |
commit | 3dbdc40b0e123100e86aec77f77e94350ea0abbd (patch) | |
tree | 9fafb4aeeac5b792372a4b964c5bdac8de561f6a /sway/ipc.c | |
parent | 2cc6d39d46640ea9d44711177ae73dd19708f350 (diff) | |
parent | f64b7e71d4ad23c6aca2038cacd196ce94493748 (diff) |
Merge pull request #226 from sce/fix_get_socketpath
ipc: Store socketname in SWAYSOCK. Fixes `--get-socketpath`.
Diffstat (limited to 'sway/ipc.c')
-rw-r--r-- | sway/ipc.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -52,7 +52,8 @@ void ipc_init(void) { ipc_sockaddr = ipc_user_sockaddr(); - if (getenv("SWAYSOCK") != NULL) { + // We want to use socket name set by user, not existing socket from another sway instance. + if (getenv("SWAYSOCK") != NULL && access(getenv("SWAYSOCK"), F_OK) == -1) { strncpy(ipc_sockaddr->sun_path, getenv("SWAYSOCK"), sizeof(ipc_sockaddr->sun_path)); } @@ -66,7 +67,12 @@ void ipc_init(void) { } // Set i3 IPC socket path so that i3-msg works out of the box - setenv("I3SOCK", ipc_sockaddr->sun_path, 1); + if (!getenv("I3SOCK")) { + setenv("I3SOCK", ipc_sockaddr->sun_path, 1); + } + if (!getenv("SWAYSOCK")) { + setenv("SWAYSOCK", ipc_sockaddr->sun_path, 1); + } ipc_client_list = create_list(); |