From f2551c20e16e66cde2c703f64eafefa9b5753129 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 28 Mar 2020 12:26:45 +1300 Subject: [PATCH] fix up xterm window title handling --- .zsh/zshrc/10-xterm_title | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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 } -- 2.39.5