kitty:get_cwd: Use KITTY_LISTEN_ON for socket path
Also verify that the socket exists before using it.
This commit is contained in:
@@ -7,7 +7,12 @@
|
|||||||
# Print the current working directory of the focused kitty window. Returns 4 if
|
# Print the current working directory of the focused kitty window. Returns 4 if
|
||||||
# none exist or is focused.
|
# none exist or is focused.
|
||||||
|
|
||||||
|
if [ -n "$KITTY_LISTEN_ON" ]; then
|
||||||
|
socket_path="${KITTY_LISTEN_ON#unix:}"
|
||||||
|
else
|
||||||
socket_path="${TMPDIR:-/tmp}/kitty.$USER/kitty${1:+-$1}.sock"
|
socket_path="${TMPDIR:-/tmp}/kitty.$USER/kitty${1:+-$1}.sock"
|
||||||
|
fi
|
||||||
|
[ -e "$socket_path" ] || exit 1
|
||||||
|
|
||||||
# NOTE: Unfortunately kitten-@-ls(1) is slow, so communicate with the socket
|
# NOTE: Unfortunately kitten-@-ls(1) is slow, so communicate with the socket
|
||||||
# directly.
|
# directly.
|
||||||
|
|||||||
Reference in New Issue
Block a user