From 07428c661d8844b98c847cf6cd177d3bf5542393 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Tue, 26 Aug 2025 13:14:32 +0200 Subject: [PATCH] kitty:daemon: Support optional instance group name --- .config/kitty/daemon.sh | 9 ++++++++- .config/kitty/get_cwd.sh | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.config/kitty/daemon.sh b/.config/kitty/daemon.sh index be1b4d7..89d079f 100755 --- a/.config/kitty/daemon.sh +++ b/.config/kitty/daemon.sh @@ -2,6 +2,8 @@ # SPDX-License-Identifier: MIT # Copyright (c) 2025 Julian Prein # +# Usage: kitty-daemon [GROUP_NAME] +# # Daemonize kitty by launching one hidden instance that new invocations can use # to create new OS windows. This makes kitty startup a lot faster since all # windows can now share a single CPU process and GPU sprite cache. Additionally @@ -11,6 +13,10 @@ # # kitty --single-instance # +# You can pass an optional instance-group as first parameter. In that case use: +# +# kitty --single-instance --instance-group +# # NOTE: `--start-as hidden` needs kitty 0.42.0 or later. TMP_DIR="${TMPDIR:-/tmp}/kitty.$USER" @@ -18,7 +24,8 @@ mkdir -p "$TMP_DIR" kitty \ --single-instance \ + ${1:+--instance-group "$1"} \ --start-as hidden \ --detach \ -o allow_remote_control=socket-only \ - --listen-on unix:"$TMP_DIR/kitty.sock" + --listen-on unix:"$TMP_DIR/kitty${1:+-$1}.sock" diff --git a/.config/kitty/get_cwd.sh b/.config/kitty/get_cwd.sh index daf36f5..3e29f61 100755 --- a/.config/kitty/get_cwd.sh +++ b/.config/kitty/get_cwd.sh @@ -2,10 +2,12 @@ # SPDX-License-Identifier: MIT # Copyright (c) 2025 Julian Prein # +# Usage: kitty-cwd [GROUP_NAME] +# # 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" +socket_path="${TMPDIR:-/tmp}/kitty.$USER/kitty${1:+-$1}.sock" # NOTE: the backticks are used for hacky line-continuation, taken from # https://stackoverflow.com/a/7729087/2092762c9