summaryrefslogtreecommitdiff
path: root/zshrc
diff options
context:
space:
mode:
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>"
}