zsh
This commit is contained in:
parent
331f498456
commit
cd0249c12f
1 changed files with 4 additions and 2 deletions
|
|
@ -36,12 +36,14 @@ sshr() {
|
||||||
ssh_host="${ssh_host%%:*}"
|
ssh_host="${ssh_host%%:*}"
|
||||||
ssh_host="${ssh_host%% *}"
|
ssh_host="${ssh_host%% *}"
|
||||||
|
|
||||||
# Emit title update BEFORE ssh
|
|
||||||
printf '\033k%s\033\\' "${ssh_host%%.*}"
|
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 "$@"
|
command ssh "$@"
|
||||||
|
|
||||||
# Restore after disconnect
|
trap - EXIT # cleanup trap if ssh exited normally
|
||||||
printf '\033k%s\033\\' "$original_name"
|
printf '\033k%s\033\\' "$original_name"
|
||||||
else
|
else
|
||||||
command ssh "$@"
|
command ssh "$@"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue