#!/bin/sh # # Set terminal's title and icon strings. # - Cameron Simpson # [ -n "$TTYLABEL_SUPPRESS" ] && exit 0 report= xclip= case $1 in -n) report=1; shift ;; esac # [ -n "$tty_yellow" ] && echo "$tty_yellow$label$tty_normal" esc="" case "$TERM" in rxvt*|xterm*) _start_title="${esc}]0;" _end_title="" _start_icon="${esc}]1;" _end_icon="" ;; sun*) ## openwin cmdtool only? case `tty` in /dev/console) ;; *)_start_title="${esc}]l" _end_title="${esc}\\\\" _start_icon="${esc}]L" _end_icon="${esc}\\\\" ;; esac ;; iris*) _start_title="${esc}P1.y" _end_title="${esc}\\" _start_icon="${esc}P3.y" _end_icon="${esc}\\" ;; tty5620*) # needs to contrive to running of myxban etc _start_title= _end_title= _start_icon= _end_icon= ;; tty630*) _start_title="${esc}[?" _end_title=";2v" _start_icon= _end_icon= ;; *)_start_title= _end_title= _start_icon= _end_icon= ;; esac [ $report ] \ && { echo "_start_title='$_start_title'" echo "_end_title='$_end_title'" echo "_start_icon='$_start_icon'" echo "_end_icon='$_end_icon'" exit 0 } # bail out if no escape sequences [ -n "$_start_title$_start_icon" ] || exit 0 # default label [ $# = 0 ] && set -- "$TTYLABEL" # clean the string up a bit label=`printf "%s" "$*" | tr -s ' \011\012\015\033' ' \['` ttylabel= [ -n "$_start_title" ] && ttylabel=$ttylabel$_start_title$label$_end_title [ -n "$_start_icon" ] && ttylabel=$ttylabel$_start_icon$label$_end_icon exec necho "$ttylabel"