From: martin f. krafft Date: Fri, 27 Mar 2020 23:26:45 +0000 (+1300) Subject: fix up xterm window title handling X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/f2551c20e16e66cde2c703f64eafefa9b5753129 fix up xterm window title handling --- 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 }