diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-01 23:05:23 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-01 23:05:51 +0300 |
| commit | 5bd21b7ed468b5ff4d1a5b2ed7e211f401eb138a (patch) | |
| tree | 672fa4625cca0ecb3e9376fc7f8e33d7b0e9deef /vendor/libghostty-vt/src/shell-integration/bash/ghostty.bash | |
| parent | 32abb3776668ee768200019c170956f67fe33a86 (diff) | |
chore: update libghostty vendor
refs #276
Diffstat (limited to 'vendor/libghostty-vt/src/shell-integration/bash/ghostty.bash')
| -rw-r--r-- | vendor/libghostty-vt/src/shell-integration/bash/ghostty.bash | 71 |
1 files changed, 8 insertions, 63 deletions
diff --git a/vendor/libghostty-vt/src/shell-integration/bash/ghostty.bash b/vendor/libghostty-vt/src/shell-integration/bash/ghostty.bash index 7eaf1397..729951ab 100644 --- a/vendor/libghostty-vt/src/shell-integration/bash/ghostty.bash +++ b/vendor/libghostty-vt/src/shell-integration/bash/ghostty.bash @@ -115,71 +115,16 @@ if [[ "$GHOSTTY_SHELL_FEATURES" == *"sudo"* && -n "$TERMINFO" ]]; then fi # SSH Integration +# +# Wrap `ssh` with `ghostty +ssh` and translate the shell-integration +# feature flags into command options. if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-* ]]; then function ssh() { - builtin local ssh_term ssh_opts - ssh_term="xterm-256color" - ssh_opts=() - - # Configure environment variables for remote session - if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-env* ]]; then - ssh_opts+=(-o "SendEnv COLORTERM TERM_PROGRAM TERM_PROGRAM_VERSION") - fi - - # Install terminfo on remote host if needed - if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-terminfo* ]]; then - builtin local ssh_user ssh_hostname - - while IFS=' ' read -r ssh_key ssh_value; do - case "$ssh_key" in - user) ssh_user="$ssh_value" ;; - hostname) ssh_hostname="$ssh_value" ;; - esac - [[ -n "$ssh_user" && -n "$ssh_hostname" ]] && break - done < <(builtin command ssh -G "$@" 2>/dev/null) - - if [[ -n "$ssh_hostname" ]]; then - builtin local ssh_target="${ssh_user}@${ssh_hostname}" - - # Check if terminfo is already cached - if "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --host="$ssh_target" >/dev/null 2>&1; then - ssh_term="xterm-ghostty" - elif builtin command -v infocmp >/dev/null 2>&1; then - builtin local ssh_terminfo ssh_cpath_dir ssh_cpath - - ssh_terminfo=$(infocmp -0 -x xterm-ghostty 2>/dev/null) - - if [[ -n "$ssh_terminfo" ]]; then - builtin echo "Setting up xterm-ghostty terminfo on $ssh_hostname..." >&2 - - ssh_cpath_dir=$(mktemp -d "/tmp/ghostty-ssh-$ssh_user.XXXXXX" 2>/dev/null) || ssh_cpath_dir="/tmp/ghostty-ssh-$ssh_user.$$" - ssh_cpath="$ssh_cpath_dir/socket" - - if builtin echo "$ssh_terminfo" | builtin command ssh -o ControlMaster=yes -o ControlPath="$ssh_cpath" -o ControlPersist=60s "$@" ' - infocmp xterm-ghostty >/dev/null 2>&1 && exit 0 - command -v tic >/dev/null 2>&1 || exit 1 - mkdir -p ~/.terminfo 2>/dev/null && tic -x - 2>/dev/null && exit 0 - exit 1 - ' 2>/dev/null; then - ssh_term="xterm-ghostty" - ssh_opts+=(-o "ControlPath=$ssh_cpath") - - # Cache successful installation - "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --add="$ssh_target" >/dev/null 2>&1 || true - else - builtin echo "Warning: Failed to install terminfo." >&2 - fi - else - builtin echo "Warning: Could not generate terminfo data." >&2 - fi - else - builtin echo "Warning: ghostty command not available for cache management." >&2 - fi - fi - fi - - # Execute SSH with TERM environment variable - TERM="$ssh_term" COLORTERM=truecolor builtin command ssh "${ssh_opts[@]}" "$@" + builtin local -a flags + flags=() + [[ "$GHOSTTY_SHELL_FEATURES" != *ssh-env* ]] && flags+=(--forward-env=false) + [[ "$GHOSTTY_SHELL_FEATURES" != *ssh-terminfo* ]] && flags+=(--terminfo=false) + "$GHOSTTY_BIN_DIR/ghostty" +ssh "${flags[@]}" -- "$@" } fi |
