mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-26 16:28:58 +01:00
Use a case structure to id terminal types
This commit is contained in:
parent
00344f7628
commit
103eb32721
@ -16,12 +16,21 @@ function title {
|
|||||||
# if it is set and empty, leave it as is
|
# if it is set and empty, leave it as is
|
||||||
: ${2=$1}
|
: ${2=$1}
|
||||||
|
|
||||||
if [[ "$TERM" == screen* ]]; then
|
case "$TERM" in
|
||||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
cygwin|xterm*|putty*|rxvt*|ansi)
|
||||||
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]2;$2:q\a" # set window name
|
||||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) 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
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
|
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
|
||||||
|
Loading…
Reference in New Issue
Block a user