aboutsummaryrefslogtreecommitdiff
path: root/sway/main.c
diff options
context:
space:
mode:
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;
}
}