diff options
author | Peter Palfrader <peter@palfrader.org> | 2013-04-15 16:51:13 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2013-04-15 16:51:13 +0000 |
commit | 57fd52fc18ce868c81ad71c1485b0c8dcd782d41 (patch) | |
tree | 826543467835f0141d265cff10987e74ecf40119 /zshrc | |
parent | 4a1a2ed3d80d1a94cca24cfea04196778b9cb2ba (diff) |
Fix a long standing title annoyance
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@613 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'zshrc')
-rw-r--r-- | zshrc | 35 |
1 files changed, 17 insertions, 18 deletions
@@ -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" } |