summaryrefslogtreecommitdiff
path: root/lib/termsupport.zsh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2015-12-01 14:04:12 +0100
committerMarc Cornellà <marc.cornella@live.com>2015-12-01 14:04:12 +0100
commit103eb32721a62062363dfaec562e882ab52d21df (patch)
tree67b8be8e42acc3b8d0edf3066bc2b14a08dda3bc /lib/termsupport.zsh
parent00344f7628099ad614a9db1b4a4d71155dc932ef (diff)
downloadzsh-103eb32721a62062363dfaec562e882ab52d21df.tar.gz
zsh-103eb32721a62062363dfaec562e882ab52d21df.tar.bz2
zsh-103eb32721a62062363dfaec562e882ab52d21df.zip
Use a case structure to id terminal types
Diffstat (limited to 'lib/termsupport.zsh')
-rw-r--r--lib/termsupport.zsh21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index f11a7dd18..178e6351b 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -16,12 +16,21 @@ function title {
# if it is set and empty, leave it as is
: ${2=$1}
- if [[ "$TERM" == screen* ]]; then
- print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
- elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == putty* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM" == cygwin ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
- print -Pn "\e]2;$2:q\a" #set window name
- print -Pn "\e]1;$1:q\a" #set icon (=tab) name
- fi
+ case "$TERM" in
+ cygwin|xterm*|putty*|rxvt*|ansi)
+ print -Pn "\e]2;$2:q\a" # set window name
+ print -Pn "\e]1;$1:q\a" # set tab name
+ ;;
+ screen*)
+ print -Pn "\ek$1:q\e\\" # set screen hardstatus
+ ;;
+ *)
+ if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
+ print -Pn "\e]2;$2:q\a" # set window name
+ print -Pn "\e]1;$1:q\a" # set tab name
+ fi
+ ;;
+ esac
}
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD