zsh: Set or unset window title according to host
Alan Pearce alan@alanpearce.uk
Thu, 15 Dec 2016 16:45:27 +0100
1 files changed, 12 insertions(+), 0 deletions(-)
jump to
M tag-zsh/config/zsh/zshrc → tag-zsh/config/zsh/zshrc
@@ -217,6 +217,18 @@ precmd_functions+=(update_terminalapp_cwd) # Run once to get initial cwd set update_terminalapp_cwd fi + + function set_window_title { printf '\e]2;%s\a' "$1" } + + function update_window_title { + if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]] + then + set_window_title "$USER@$HOST" + else + set_window_title "" + fi + } + precmd_functions+=(update_window_title) fi if zplug check clvv/fasd