This is the mail archive of the
cygwin-xfree
mailing list for the Cygwin XFree86 project.
Re: How to add a title to xterm
- From: "Ehud Karni" <ehud at unix dot mvs dot co dot il>
- To: fergus at bonhard dot uklinux dot net
- Cc: cygwin-xfree at cygwin dot com
- Date: Wed, 7 Dec 2005 18:43:29 +0200
- Subject: Re: How to add a title to xterm
- References: <000001c5fafb$2b6c72b0$500210ac@tcgp.dundee.ac.uk>
- Reply-to: ehud at unix dot mvs dot co dot il
- Reply-to: cygwin-xfree at cygwin dot com
On Wed, 7 Dec 2005 06:54:41 -0000, fergus <fergus@bonhard.uklinux.net> wrote:
>
> > How to add a title to xterm?
>
> I do not use startx: for me, it sets up unnecessary or inconvenient
> defaults.
You can always set the xterm title by sending it the string: Esc ] 0 ;
<your title> ^G . You can do it from the xterm application (writing to
/dev/tty or stdout if its connected, or externally, by writing to
/dev/tty<n> [Cygwin] or /dev/pts/<n> [Linux]).
Bellow is a small script that update the title if it is run on an
interactive xterm (the 2nd is a tty emulator written here).
Ehud
#! /bin/sh -e
# this script sets the TTY title to 1st argument
# --------------------------------------------------
if [ -t 1 ] ; then # do only if stdout is terminal
TTL=`echo "$1" | sed -e "s/ [ ]*/ /g"` # any length of spaces to 1 space
case "$TERM" in
xter* ) echo "\033]0;$TTL\a\c" # write it to xterm window title
;;
npc* ) DTTL=`echo "$TTL\c" | od -An -tu1 -v | tr "\012" " " | sed -e "s/ [ ]*/;/g"`
echo "\033[=/${DTTL:1:999};253;t\c" # For Mivtach Simon TTY
;;
esac
fi
############################## set_tty_title ##############################
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/