diff --git a/.config/kitty/daemon.sh b/.config/kitty/daemon.sh index 9e26b3f..be1b4d7 100755 --- a/.config/kitty/daemon.sh +++ b/.config/kitty/daemon.sh @@ -13,9 +13,12 @@ # # NOTE: `--start-as hidden` needs kitty 0.42.0 or later. +TMP_DIR="${TMPDIR:-/tmp}/kitty.$USER" +mkdir -p "$TMP_DIR" + kitty \ --single-instance \ --start-as hidden \ --detach \ -o allow_remote_control=socket-only \ - --listen-on unix:/tmp/mykitty + --listen-on unix:"$TMP_DIR/kitty.sock" diff --git a/.config/kitty/get_cwd.sh b/.config/kitty/get_cwd.sh index 63cdd6b..daf36f5 100755 --- a/.config/kitty/get_cwd.sh +++ b/.config/kitty/get_cwd.sh @@ -5,9 +5,11 @@ # Print the current working directory of the focused kitty window. Returns 4 if # none exist or is focused. +socket_path="${TMPDIR:-/tmp}/kitty.$USER/kitty.sock" + # NOTE: the backticks are used for hacky line-continuation, taken from # https://stackoverflow.com/a/7729087/2092762c9 -kitten @ --to unix:/tmp/mykitty ls \ +kitten @ --to unix:"$socket_path" ls \ | jq -er ".[]` ` | select(.is_focused).tabs.[]` ` | select(.is_focused).windows.[]`