Use default Kitty socket path rather than XDG_CACHE_HOME

This commit is contained in:
Danielle McLean 2024-07-09 10:40:38 +10:00
parent 7b7b6624a5
commit ce52cd1c69
Signed by: 00dani
GPG key ID: 6854781A0488421C

View file

@ -1,5 +1,4 @@
#!/bin/zsh #!/bin/zsh
: ${XDG_CACHE_HOME:=~/.cache}
MAC_KITTY=/Applications/kitty.app/Contents/MacOS MAC_KITTY=/Applications/kitty.app/Contents/MacOS
if (( $+commands[kitty] == 0 )); then if (( $+commands[kitty] == 0 )); then
@ -10,4 +9,12 @@ if (( $+commands[kitty] == 0 )); then
exit 1 exit 1
fi fi
fi fi
exec kitty @ --to unix:$XDG_CACHE_HOME/kitty/kitty.sock "$@"
# Sort the sockets youngest-first, because the youngest one is most likely to be still alive.
sockets=( ${TMPDIR}/kitty-socket-*(om) )
if (( $#sockets < 1 )); then
print "Sorry, no Kitty socket could be found. Check $TMPDIR for 'kitty-socket' files." >&2
exit 2
fi
exec kitty @ --to unix:$sockets[1] "$@"