[comp.windows.x] changing title

soulard@iznogoud.inria.fr (Herve Soulard) (02/13/90)

	Title name and icon name of a window can be change
	using these control sequences :

		<ESC> ] 0 ; string <BEL>  and string will become
					   the title and icon name
		<ESC> ] 1 ; string <BEL>  for icon name only
		<ESC> ] 2 ; string <BEL>  for title name only


	This was found in the sources of xterm ot twm, I don't remenber.



			Herve.	

jc@minya.UUCP (John Chambers) (02/21/90)

In article <347@seti.inria.fr> soulard@iznogoud.inria.fr (Herve Soulard) writes:
> 	Title name and icon name of a window can be change
> 	using these control sequences :
> 		<ESC> ] 0 ; string <BEL>  and string will become
> 					   the title and icon name
> 		<ESC> ] 1 ; string <BEL>  for icon name only
> 		<ESC> ] 2 ; string <BEL>  for title name only

OK, now that that's out in the open (;-), here's a followup problem.  As
someone (I think it was me) said earlier, you can make you .cshrc define
a bunch of aliases:
|	switch ( "$TERM" )	# Some terminal-specific stuff.
|		# The 'setttl' command puts the hostname and cwd in the title bar.
|		# The 'putttl' command puts its args in the title bar.
|		# The 'setprompt' command sets the prompt.
|		case xterm*:	# For xterm, we know how to write to the title bar.
|			alias	setttl 'echo "]0;"$HOST":"`pwd`""'
|			alias	putttl 'echo "]0;"\!*""'

and so on.  This works just fine, and I go on to alias cd to call setttl
to get the hostname and cwd into the title bar.  It also produces a
newline, which goes to the window as ordinary output, causing a blank
line on the screen.  This isn't a real big deal, but it's unaesthetic,
sloppy, and wastes screen space.  I've tried suppressing it, to no
avail.  I've tried both 'echo -n ...' and 'echo ...\c', and the result
was "-n" in the title bar or "c" on the next line.  '\\c' didn't work,
either; it put "\c" out to the screen.  Putting the \c before the ^G
isn't effective, either; you get a 'c' output in that case, too.

As I said, it's not a real major catastrophe, but I do like to make
things neat and clean, and this definitely isn't that.  Can anyone come
up with a variant of these aliases that put ALL their output to the
title bar, and nothing (i.e., no CR of LF) to the main window?

-- 
John Chambers ...!{harvard,ima,mit-eddie}!minya!jc

[Sorry, no clever saying today.]

duanev@kauai.ACA.MCC.COM (Duane Voth) (03/01/90)

In article <112@minya.UUCP>, jc@minya.UUCP (John Chambers) writes:
> In article <347@seti.inria.fr> soulard@iznogoud.inria.fr (Herve Soulard) writes:
> > 	Title name and icon name of a window can be change
> > 	using these control sequences :
> > 		<ESC> ] 0 ; string <BEL>  and string will become
> > 					   the title and icon name
>
> ..  This works just fine, and I go on to alias cd to call setttl
> to get the hostname and cwd into the title bar.  It also produces a
> newline, which goes to the window as ordinary output, causing a blank
> line on the screen.

I've found that a second ESC at the end of the title string "suppreses"
the newline with no apparent side affects.  My csh aliases look like:

	xlabel  echo -n "${ESC}]0;!*${ESC}"
	xititle echo -n "${ESC}]1;!*${ESC}"
	xtitle  echo -n "${ESC}]2;!*${ESC}"

where ESC was "set"ed to ^[ previously.


-- 
--- duane voth                                         duanev@mcc.com
----    {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!pp!duanev
--- ALL systems are arbitrary!  Effectiveness is the measure of Truth
--