From f6706a55ecf04b2e8510ff9f3b50435ede7c1255 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 Mar 2022 09:20:08 +0530 Subject: [PATCH] ... --- shell-integration/bash/kitty.bash | 1 + shell-integration/zsh/kitty-integration | 1 + 2 files changed, 2 insertions(+) diff --git a/shell-integration/bash/kitty.bash b/shell-integration/bash/kitty.bash index 68cebd5b6..daa3fdaaf 100644 --- a/shell-integration/bash/kitty.bash +++ b/shell-integration/bash/kitty.bash @@ -158,6 +158,7 @@ _ksi_main() { if [[ -n "$SSH_TTY$SSH2_TTY" ]]; then _ksi_prompt[hostname_prefix]="\h: "; elif [[ -n "$(builtin command -v who)" ]]; then + # OpenSSH's sshd creates entries in utmp for every login so use those [[ "$(builtin command who -m 2> /dev/null)" =~ "\([a-fA-F.:0-9]+\)$" ]] && _ksi_prompt[hostname_prefix]="\h: "; fi # see https://www.gnu.org/software/bash/manual/html_node/Controlling-the-Prompt.html#Controlling-the-Prompt diff --git a/shell-integration/zsh/kitty-integration b/shell-integration/zsh/kitty-integration index 34bfe55ec..2b788933a 100644 --- a/shell-integration/zsh/kitty-integration +++ b/shell-integration/zsh/kitty-integration @@ -236,6 +236,7 @@ _ksi_deferred_init() { if [[ -n "$SSH_TTY$SSH2_TTY" ]]; then is_ssh_session="y"; elif [[ -n "$(builtin command -v who)" ]]; then + # OpenSSH's sshd creates entries in utmp for every login so use those [[ "$(builtin command who -m 2> /dev/null)" =~ "\([a-fA-F.:0-9]+\)$" ]] && is_ssh_session="y"; fi