From 57fd52fc18ce868c81ad71c1485b0c8dcd782d41 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 15 Apr 2013 16:51:13 +0000 Subject: Fix a long standing title annoyance git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@613 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- zshrc | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'zshrc') diff --git a/zshrc b/zshrc index edf7b19..bfe0c60 100644 --- a/zshrc +++ b/zshrc @@ -1,7 +1,7 @@ #! /bin/false if [ -e /etc/zsh/zshenv ]; then - . /etc/zsh/zshenv + . /etc/zsh/zshenv fi HOSTNAME="`hostname`" @@ -253,13 +253,13 @@ fi case $TERM in xterm*|rxvt*) function update-title() { - print -Pn "\033]0;$1\007" + print -n "\033]0;$1\007" } function build-and-update-title() { local location cmd title - location="$1" - cmd="$2" - if [ "$cmd" = "" ]; then + location="$(print -P $1)" + cmd="${2:-}" + if [ -z "$cmd" ]; then title="$location" else title="$cmd [$location]" @@ -272,19 +272,18 @@ case $TERM in screen*) if [ -n "${TMUX:-}" ] && [ -x /usr/bin/tmux ] ; then function update-title() { - print -Pn "\033]0;$1\007" + print -n "\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" + location="$(print -P $1)" + cmd="${2:-}" + if [ -z "$cmd" ]; then + title="$location" + tmux rename-window "$title" else tmux setw automatic-rename on > /dev/null - title="$cmd [$location]" - title=`echo $title | tr '\n' ' '` + title="$location:$cmd" fi update-title "$title" } @@ -294,12 +293,12 @@ case $TERM in } function build-and-update-title() { local location cmd title - location="$1" - cmd="$2" - if [ "$cmd" = "" ]; then - title=`print -Pn "%~"` + location="$(print -P "%~")" + cmd="${2:-}" + if [ -z "$cmd" ]; then + title="$location" else - title=`print -Pn "%~:$cmd"` + title="$location:$cmd" fi update-title "$title" } -- cgit v1.2.3