kitty:daemon: Use TMPDIR and support multi-user

This commit is contained in:
2025-08-26 13:10:26 +02:00
parent c09ed22389
commit a7e4c2c770
2 changed files with 7 additions and 2 deletions

View File

@@ -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"

View File

@@ -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.[]`