From cd0249c12fa4da14d10ab5f860c0b1c3839c29e0 Mon Sep 17 00:00:00 2001 From: hanez Date: Wed, 23 Jul 2025 01:58:54 +0200 Subject: [PATCH] zsh --- .zsh/functions.d/s.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.zsh/functions.d/s.sh b/.zsh/functions.d/s.sh index 93284586..2e26ea3a 100644 --- a/.zsh/functions.d/s.sh +++ b/.zsh/functions.d/s.sh @@ -36,12 +36,14 @@ sshr() { ssh_host="${ssh_host%%:*}" ssh_host="${ssh_host%% *}" - # Emit title update BEFORE ssh printf '\033k%s\033\\' "${ssh_host%%.*}" + # Set up trap to restore title even if interrupted + trap 'printf "\033k%s\033\\n" "$original_name"' EXIT + command ssh "$@" - # Restore after disconnect + trap - EXIT # cleanup trap if ssh exited normally printf '\033k%s\033\\' "$original_name" else command ssh "$@"