From d1d127a4f1322869e3b7df60293d81510b89120f Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 21 Mar 2012 19:54:19 +0000 Subject: title stuff for tmux git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@507 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- zshrc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'zshrc') diff --git a/zshrc b/zshrc index 7ed1f02..fbb47b9 100644 --- a/zshrc +++ b/zshrc @@ -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>" } -- cgit v1.2.3