kitty:daemon: Use TMPDIR and support multi-user
This commit is contained in:
@@ -13,9 +13,12 @@
|
|||||||
#
|
#
|
||||||
# NOTE: `--start-as hidden` needs kitty 0.42.0 or later.
|
# NOTE: `--start-as hidden` needs kitty 0.42.0 or later.
|
||||||
|
|
||||||
|
TMP_DIR="${TMPDIR:-/tmp}/kitty.$USER"
|
||||||
|
mkdir -p "$TMP_DIR"
|
||||||
|
|
||||||
kitty \
|
kitty \
|
||||||
--single-instance \
|
--single-instance \
|
||||||
--start-as hidden \
|
--start-as hidden \
|
||||||
--detach \
|
--detach \
|
||||||
-o allow_remote_control=socket-only \
|
-o allow_remote_control=socket-only \
|
||||||
--listen-on unix:/tmp/mykitty
|
--listen-on unix:"$TMP_DIR/kitty.sock"
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
|
socket_path="${TMPDIR:-/tmp}/kitty.$USER/kitty.sock"
|
||||||
|
|
||||||
# NOTE: the backticks are used for hacky line-continuation, taken from
|
# NOTE: the backticks are used for hacky line-continuation, taken from
|
||||||
# https://stackoverflow.com/a/7729087/2092762c9
|
# https://stackoverflow.com/a/7729087/2092762c9
|
||||||
kitten @ --to unix:/tmp/mykitty ls \
|
kitten @ --to unix:"$socket_path" ls \
|
||||||
| jq -er ".[]`
|
| jq -er ".[]`
|
||||||
` | select(.is_focused).tabs.[]`
|
` | select(.is_focused).tabs.[]`
|
||||||
` | select(.is_focused).windows.[]`
|
` | select(.is_focused).windows.[]`
|
||||||
|
|||||||
Reference in New Issue
Block a user