diff options
-rw-r--r-- | zshrc | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -261,7 +261,25 @@ case $TERM in ;; screen*) - if [ -x /usr/bin/screen ] || [ -x /usr/local/bin/screen ]; then + if [ -n "${TMUX:-}" ] && [ -x /usr/bin/tmux ] ; then + function update-title() { + print -Pn "\033]0;$1\007" + } + function build-and-update-title() { + local location cmd title + location="$1" + cmd="$2" + if [ "$cmd" = "" ]; then + tmux rename-window `print -Pn "%~"` + title="%n@%m" + else + tmux setw automatic-rename on > /dev/null + title="$cmd [$location]" + title=`echo $title | tr '\n' ' '` + fi + update-title "$title" + } + elif [ -x /usr/bin/screen ] || [ -x /usr/local/bin/screen ]; then function update-title() { screen -X title "<$1>" } |