From 84a48d00be7935135429de608060e46b6e19de9c Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Thu, 4 Jun 2015 00:45:14 +0200 Subject: [PATCH] zsh: Set window title in *rxvt* and xterm --- zsh/zshrc.local | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/zsh/zshrc.local b/zsh/zshrc.local index 2cc79f1..ac17292 100644 --- a/zsh/zshrc.local +++ b/zsh/zshrc.local @@ -73,6 +73,24 @@ if [[ "$TERM" != "dumb" ]]; then fi fi +# set terminal title +case $TERM in + (*xterm* | *rxvt*) + + # Write some info to terminal title. + # This is seen when the shell prompts for input. + function precmd { + print -Pn "\e]0;zsh%L @%m %(1j,%j job%(2j|s|); ,)%~\a" + } + # Write command and args to terminal title. + # This is seen while the shell waits for a command to complete. + function preexec { + printf "\033]0;%s @%s\a" "$1" "$HOST" + } + + ;; +esac + # Set prompt #PS1=$'%(!.%{\e[01;32m%}.%{\e[01;31m%})%(?..%? )%(!.%{\e[01;31m%}.%{\e[01;32m%})%n@%m%{\e[01;34m%} %~ %{\e[00m%}%(!.#.$) '