- echo -ne "\033]0;${TITLE}\007" # Set xterm caption
- ;;
-esac
-
-case "$TERM" in
- screen*)
- echo -ne "\033k${TITLE}\033\\" # Set screen caption
+ XTITLE="\033]0;${TITLE}\007" # Set xterm title/icon
+ case "$TERM" in
+ screen*)
+ XTITLE="\033P${XTITLE}\033\\\\" # Set xterm title/icon under screen/tmux
+ XTITLE="${XTITLE}\033k${TITLE}\033\\\\" # Set screen/tmux caption
+ ;;
+ esac
+ echo -n "$XTITLE"