103eb32721a62062363dfaec562e882ab52d21df
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Use a case structure to id terminal types
Diff
1diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
2index f11a7dd182b4b454f64ed2368f8c3ab929efa65e..178e6351b20b7380c654dbf92358947e71d31bcd 100644
3--- a/lib/termsupport.zsh
4+++ b/lib/termsupport.zsh
5@@ -16,12 +16,21 @@ function title {
6 # if it is set and empty, leave it as is
7 : ${2=$1}
8
9- if [[ "$TERM" == screen* ]]; then
10- print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
11- elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == putty* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM" == cygwin ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
12- print -Pn "\e]2;$2:q\a" #set window name
13- print -Pn "\e]1;$1:q\a" #set icon (=tab) name
14- fi
15+ case "$TERM" in
16+ cygwin|xterm*|putty*|rxvt*|ansi)
17+ print -Pn "\e]2;$2:q\a" # set window name
18+ print -Pn "\e]1;$1:q\a" # set tab name
19+ ;;
20+ screen*)
21+ print -Pn "\ek$1:q\e\\" # set screen hardstatus
22+ ;;
23+ *)
24+ if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
25+ print -Pn "\e]2;$2:q\a" # set window name
26+ print -Pn "\e]1;$1:q\a" # set tab name
27+ fi
28+ ;;
29+ esac
30 }
31
32 ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD