summaryrefslogtreecommitdiff
path: root/src/libremessages
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-26 01:30:54 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-26 01:30:54 -0500
commit066c7716e69817af9e08782a7fbfc3dc2eb6356b (patch)
tree30242661a68ab2c9dcfb4b72bd63908abb46078d /src/libremessages
parentb72653f654882335026d04de5c25ea02c20e8412 (diff)
libremessages: term_title: learn about xterm/rxvt
Diffstat (limited to 'src/libremessages')
-rwxr-xr-xsrc/libremessages8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libremessages b/src/libremessages
index 756e19a..ff7476b 100755
--- a/src/libremessages
+++ b/src/libremessages
@@ -88,9 +88,13 @@ stat_done() {
}
# Set the terminal title
-# TODO test on several terms - it works on screen/tmux
term_title() {
- printf "\033k%s\033\\" "$@"
+ local fmt=''
+ case "$TERM" in
+ screen|tmux) fmt='\ek%s\e\\';;
+ xterm*|rxvt*) fmt='\e]0;%s\a';;
+ esac
+ printf "$fmt" "$*"
}
# usage : in_array( $needle, $haystack )