d7797503418422148e84bc06c9e446bdd77c3a01

Author
moyamo <moyamodehacker@gmail.com>
Committer
moyamo <moyamodehacker@gmail.com>
Date

Message

Default to using terminfo to set the terminal title

Currently, the title is only set on supported terminals (i.e. xterm,
urxvt, screen etc.). Using terminfo entries to set the terminal title
adds support for many more terminals.

Diff

 1diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 2index 7cf15b0a0ee2d09775ee03aa7d419cd81961364e..84c1e186e3ff324891197c063618087e55380213 100644
 3--- a/lib/termsupport.zsh
 4+++ b/lib/termsupport.zsh
 5@@ -28,6 +28,14 @@ function title {
 6       if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
 7         print -Pn "\e]2;$2:q\a" # set window name
 8         print -Pn "\e]1;$1:q\a" # set tab name
 9+      else
10+        # Try to use terminfo to set the title
11+        # If the feature is available set title
12+        if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
13+		echoti tsl
14+		print -Pn "$1"
15+		echoti fsl
16+        fi
17       fi
18       ;;
19   esac