X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/33230b65afa1076218abff057d0bbcc7486af0a8..f2551c20e16e66cde2c703f64eafefa9b5753129:/.zsh/zshrc/10-xterm_title?ds=sidebyside diff --git a/.zsh/zshrc/10-xterm_title b/.zsh/zshrc/10-xterm_title index b695811..05da3de 100644 --- a/.zsh/zshrc/10-xterm_title +++ b/.zsh/zshrc/10-xterm_title @@ -13,14 +13,20 @@ autoload -U add-zsh-hook __set_xterm_title() { emulate -L zsh + local typ case $TERM in - screen) - print -nR $'\033k'$1$'\033'\\ + (tmux|tmux-*) typ=tmux;; + (screen|screen-*) if [ -n "$TMUX" ]; then typ=tmux else typ=screen fi;; + (*) typ=xterm + esac + + case "$typ" in + (xterm) print -nR $'\033]0;'$*$'\a';; + (screen) + print -nR $'\033k'$1$'\033'\\ print -nR $'\033]0;'$2$'\a' ;; - xterm|rxvt*) - print -nR $'\033]0;'$*$'\a' - ;; + (tmux) print -nR $'\033]2;'$*$'\a';; esac } @@ -36,6 +42,7 @@ __get_session_flags() { __get_standard_prompt() { emulate -L zsh + print -n "[${${(%):-%l}#pts/}]" [[ -z $SSH_CLIENT ]] || print -nP "%m" print -P "%#%25\<..\<%~ $(__get_session_flags)" }