X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/308358cae2dd574c92560b7b20cc51394ddb9708..HEAD:/.zsh/zshrc/10-xterm_title diff --git a/.zsh/zshrc/10-xterm_title b/.zsh/zshrc/10-xterm_title index c694eeb..82f311a 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,9 +42,8 @@ __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)" + print -P "@${${(%):-%l}#pts/}%#%25\<..\<%~ $(__get_session_flags)" } _set_plain_xterm_title() {