From f3c301ee8b94c3354080695326ceedc7a3866321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 2 Aug 2020 12:28:53 +0200 Subject: [PATCH] doc: foot.1: fix default path in -s,--server The documentation incorrectly stated that the default path is $XDG_RUNTIME_DIR/foot.sock. The correct default path is * $XDG_RUNTIME_DIR/foot-$XDG_SESSION_ID.sock * $XDG_RUNTIME_DIR/foot-no-session.sock * /tmp/foot.sock Depending on whether XDG_RUNTIME_DIR and XDG_SESSION_ID has been set or not. This also removes the '<>' from the default when XDG_SESSION_ID is not set. Closes #53. --- client.c | 2 +- config.c | 2 +- doc/foot.1.scd | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/client.c b/client.c index 0d0feb49..aac2e95a 100644 --- a/client.c +++ b/client.c @@ -176,7 +176,7 @@ main(int argc, char *const *argv) const char *xdg_runtime = getenv("XDG_RUNTIME_DIR"); if (xdg_runtime != NULL) { if (xdg_session_id == NULL) - xdg_session_id = ""; + xdg_session_id = "no-session"; snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/foot-%s.sock", xdg_runtime, xdg_session_id); if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == 0) diff --git a/config.c b/config.c index c03bb4bf..50bf8a19 100644 --- a/config.c +++ b/config.c @@ -1194,7 +1194,7 @@ get_server_socket_path(void) return strdup("/tmp/foot.sock"); if (xdg_session_id == NULL) - xdg_session_id = ""; + xdg_session_id = "no-session"; char *path = malloc(strlen(xdg_runtime) + 1 + strlen("foot-.sock") + strlen(xdg_session_id) + 1); sprintf(path, "%s/foot-%s.sock", xdg_runtime, xdg_session_id); diff --git a/doc/foot.1.scd b/doc/foot.1.scd index c8b1f6e7..bf45777e 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -13,7 +13,7 @@ arguments, to execute (instead of the default shell). # OPTIONS *-c*,*--config*=_PATH_ - Path to configuration file. Default: *XDG_CONFIG_HOME/footrc*. + Path to configuration file. Default: *$XDG_CONFIG_HOME/footrc*. *--check-config* Verify configuration and then exit with 0 if ok, otherwise exit @@ -80,9 +80,18 @@ arguments, to execute (instead of the default shell). Also be aware that should one terminal crash, it will take all the others with it. - You may optionally override the default socket path, - *XDG\_RUNTIME\_DIR/foot.sock*. If you do so, you will need to use - the *--server-socket* option in *footclient*(1). + The default path is + *$XDG\_RUNTIME\_DIR/foot-$XDG\_SESSION\_ID.sock*. + + If *$XDG_RUNTIME_DIR* is not set, the default path is instead + */tmp/foot.sock*. + + If *$XDG_RUNTIME_DIR* is set, but *$XDG_SESSION_ID* is not, the + default path is *$XDG_RUNTIME_DIR/foot-no-session.sock*. + + Note that if you change the default, you will also need to use the + *--server-socket* option in *footclient*(1) and point it to your + custom socket path. *--hold* Remain open after child process exits.