aboutsummaryrefslogtreecommitdiff
path: root/sway/main.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-11-13 14:10:00 -0500
committerDrew DeVault <sir@cmpwn.com>2015-11-13 14:10:00 -0500
commit3dbdc40b0e123100e86aec77f77e94350ea0abbd (patch)
tree9fafb4aeeac5b792372a4b964c5bdac8de561f6a /sway/main.c
parent2cc6d39d46640ea9d44711177ae73dd19708f350 (diff)
parentf64b7e71d4ad23c6aca2038cacd196ce94493748 (diff)
Merge pull request #226 from sce/fix_get_socketpath
ipc: Store socketname in SWAYSOCK. Fixes `--get-socketpath`.
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sway/main.c b/sway/main.c
index a4fe5823..4afbccbd 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -107,10 +107,13 @@ int main(int argc, char **argv) {
verbose = 1;
break;
case 'p': ; // --get-socketpath
- struct sockaddr_un *ipc_sockaddr = ipc_user_sockaddr();
- fprintf(stdout, "%s\n", ipc_sockaddr->sun_path);
- free(ipc_sockaddr);
- exit(0);
+ if (getenv("SWAYSOCK")) {
+ fprintf(stdout, "%s\n", getenv("SWAYSOCK"));
+ exit(0);
+ } else {
+ fprintf(stderr, "sway socket not detected.\n");
+ exit(1);
+ }
break;
}
}