summaryrefslogtreecommitdiff
path: root/zshrc
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2012-03-21 19:54:19 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2012-03-21 19:54:19 +0000
commitd1d127a4f1322869e3b7df60293d81510b89120f (patch)
tree7fa1c5f3d959e294a9c9501b45f1f571f950b1c8 /zshrc
parent3921577f26c57ecf852960fcc85db0b9bbb75a6d (diff)
title stuff for tmux
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@507 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'zshrc')
-rw-r--r--zshrc20
1 files changed, 19 insertions, 1 deletions
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>"
}