From e9f450ebb67d86fdfefd8cfad694de390948a636 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Wed, 19 Aug 2015 10:36:35 +0200 Subject: [PATCH] 10_terminal: Don't set "user@host" window title for remote commands --- core/10_terminal/10_terminal.zshrc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/10_terminal/10_terminal.zshrc b/core/10_terminal/10_terminal.zshrc index e300e75..f2665b6 100644 --- a/core/10_terminal/10_terminal.zshrc +++ b/core/10_terminal/10_terminal.zshrc @@ -32,17 +32,24 @@ precmd_functions+=(axzsh_terminal_title_precmd) # Update terminal titles befor executing a command function axzsh_terminal_title_preexec { local cmd="${1[(w)1]}" + local remote="" + case "$cmd" in + "mosh"*|"ssh"*|"telnet"*) + remote=1 + ;; + esac if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then # Apple Terminal.app ... - case "$cmd" in - "mosh"*|"ssh"*|"telnet"*) + if [[ -n "$remote" ]]; then # Reset CWD for remote commands printf '\e]7;%s\a' '' - ;; - esac + fi fi axzsh_terminal_set_icon_title "$cmd" - axzsh_terminal_set_window_title "$LOGNAME@$SHORT_HOST" + + [[ -z "$remote" ]] \ + && axzsh_terminal_set_window_title "$LOGNAME@$SHORT_HOST$TITLE_ADD" \ + || axzsh_terminal_set_window_title "$1" } preexec_functions+=(axzsh_terminal_title_preexec) -- 2.39.2