ssh kitten: Fix kitten not being on PATH when sshing into Debian systems

Fixes #7160
This commit is contained in:
Kovid Goyal
2025-01-02 19:46:50 +05:30
parent dd249df5eb
commit 9d027e4fbd
6 changed files with 28 additions and 2 deletions

View File

@@ -85,11 +85,14 @@ Detailed list of changes
------------------------------------- -------------------------------------
0.38.2 [future] 0.38.2 [future]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- When mapping a custom kitten allow using shell escaping for the kitten path (:iss:`8178`) - When mapping a custom kitten allow using shell escaping for the kitten path (:iss:`8178`)
- Fix border colors not being changed by auto light/dark themes at startup (:iss:`8180`) - Fix border colors not being changed by auto light/dark themes at startup (:iss:`8180`)
- ssh kitten: Fix kitten not being on PATH when sshing into Debian systems (:iss:`7160`)
0.38.1 [2024-12-26] 0.38.1 [2024-12-26]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -115,6 +115,12 @@ _ksi_main() {
IFS="$ifs" IFS="$ifs"
builtin unset KITTY_SHELL_INTEGRATION builtin unset KITTY_SHELL_INTEGRATION
if [[ -n "$SSH_KITTEN_KITTY_DIR" ]]; then
if [[ ! "$PATH" =~ (^|:)${SSH_KITTEN_KITTY_DIR}(:|$) ]] && [[ -z "$(builtin command -v kitten)" ]]; then
builtin export PATH="${PATH}:${SSH_KITTEN_KITTY_DIR}"
fi
builtin unset SSH_KITTEN_KITTY_DIR
fi
_ksi_debug_print() { _ksi_debug_print() {
# print a line to STDERR of parent kitty process # print a line to STDERR of parent kitty process

View File

@@ -29,6 +29,14 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
test -n "$KITTY_SHELL_INTEGRATION" || return 0 test -n "$KITTY_SHELL_INTEGRATION" || return 0
set --local _ksi (string split " " -- "$KITTY_SHELL_INTEGRATION") set --local _ksi (string split " " -- "$KITTY_SHELL_INTEGRATION")
set --erase KITTY_SHELL_INTEGRATION set --erase KITTY_SHELL_INTEGRATION
if test -n "$SSH_KITTEN_KITTY_DIR"
if not contains -- "$SSH_KITTEN_KITTY_DIR" "$PATH"
if not type kitten 2> /dev/null > /dev/null
set -gx PATH "$PATH" "$SSH_KITTEN_KITTY_DIR"
end
end
set --erase SSH_KITTEN_KITTY_DIR
end
# Enable cursor shape changes for default mode and vi mode # Enable cursor shape changes for default mode and vi mode
if not contains "no-cursor" $_ksi if not contains "no-cursor" $_ksi

View File

@@ -177,10 +177,11 @@ fi' > "$sh_script"
} }
install_kitty_bootstrap() { install_kitty_bootstrap() {
kitty_dir="$data_dir/kitty/bin"
export SSH_KITTEN_KITTY_DIR="$kitty_dir"
kitty_exists="n" kitty_exists="n"
command -v kitty 2> /dev/null > /dev/null && kitty_exists="y" command -v kitty 2> /dev/null > /dev/null && kitty_exists="y"
if [ "$kitty_remote" = "yes" -o "$kitty_remote-$kitty_exists" = "if-needed-n" ]; then if [ "$kitty_remote" = "yes" -o "$kitty_remote-$kitty_exists" = "if-needed-n" ]; then
kitty_dir="$data_dir/kitty/bin"
if [ "$kitty_exists" = "y" ]; then if [ "$kitty_exists" = "y" ]; then
export PATH="$kitty_dir:$PATH" export PATH="$kitty_dir:$PATH"
else else

View File

@@ -284,8 +284,9 @@ def exec_with_shell_integration():
def install_kitty_bootstrap(): def install_kitty_bootstrap():
kitty_remote = os.environ.pop('KITTY_REMOTE', '') kitty_remote = os.environ.pop('KITTY_REMOTE', '')
kitty_exists = shutil.which('kitty') kitty_exists = shutil.which('kitty')
kitty_dir = os.path.join(data_dir, 'kitty', 'bin')
os.environ['SSH_KITTEN_KITTY_DIR'] = kitty_dir
if kitty_remote == 'yes' or (kitty_remote == 'if-needed' and not kitty_exists): if kitty_remote == 'yes' or (kitty_remote == 'if-needed' and not kitty_exists):
kitty_dir = os.path.join(data_dir, 'kitty', 'bin')
if kitty_exists: if kitty_exists:
os.environ['PATH'] = kitty_dir + os.pathsep + os.environ['PATH'] os.environ['PATH'] = kitty_dir + os.pathsep + os.environ['PATH']
else: else:

View File

@@ -89,6 +89,13 @@ _ksi_deferred_init() {
opt=(${(s: :)KITTY_SHELL_INTEGRATION}) opt=(${(s: :)KITTY_SHELL_INTEGRATION})
builtin unset KITTY_SHELL_INTEGRATION builtin unset KITTY_SHELL_INTEGRATION
if [[ -n "$SSH_KITTEN_KITTY_DIR" ]]; then
if [[ ! "$PATH" =~ (^|:)${SSH_KITTEN_KITTY_DIR}(:|$) ]] && [[ -z "$(builtin command -v kitten)" ]]; then
builtin export PATH="${PATH}:${SSH_KITTEN_KITTY_DIR}"
fi
builtin unset SSH_KITTEN_KITTY_DIR
fi
# The directory where kitty-integration is located: /.../shell-integration/zsh. # The directory where kitty-integration is located: /.../shell-integration/zsh.
builtin local self_dir="${functions_source[_ksi_deferred_init]:A:h}" builtin local self_dir="${functions_source[_ksi_deferred_init]:A:h}"
# The directory with _kitty. We store it in a directory of its own rather than # The directory with _kitty. We store it in a directory of its own rather than