X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/b6b8f018a4ab02d6b23abe65f65e78fbcb60ced6..f2551c20e16e66cde2c703f64eafefa9b5753129:/.zsh/zshrc/10-xterm_title diff --git a/.zsh/zshrc/10-xterm_title b/.zsh/zshrc/10-xterm_title index c694eeb..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 }