Re: gnome-terminal window titles



On Thu, Jan 25, 2001 at 09:49:20AM -0800 or thereabouts, Michael Benedetti wrote:
> 
> Hi,
> 
> Is there a simple method of changing an existing gnome-term's title?  If
> not is there a simple program available to do this?

Stick these lines (at bottom of post) into a file called titlebar.sh in 
your home directory. Chmod it to be executable (runnable): 
chmod 755 titlebar.sh will do that for you.

Then "~/titlebar.sh Plop" at a prompt will change your titlebar to Plop.

It will understand spaces. It's not very good at special characters: 
you must escape some with a backslash, so that 
"~/titlebar.sh IRC: #gnome" won't work, but
"~/titlebar.sh IRC: \#gnome" does.

You don't have to call it titlebar.sh, of course. It just seemed
logical. 

If you are curious what's going on, then this is making use of
the special xterm control and escape codes which you can find in
the xterm documentation: I found it in 
/usr/share/doc/XFree86-doc-4.0.1/xterm/ctlseqs.PS.gz and it was
provided by the XFree86-doc-4.0.1-1 package on RH. The reason that's
a PS file becomes abundantly obvious when you view it. Quite why it
unpacks into a .gz escapes me. I got very very bored of trying to
remember the exact sequence of control characters to type, and hence
this very stupid but useful script.

Telsa

#!/bin/sh

# How to make your xterm, gnome-terminal, etc, have a new title if
# you didn't start it with xterm --title or gnome-terminal --title.
#
# $* is "whatever you typed as an argument when you ran the script"
# So 'titlebar.sh Horace' gives you a window called Horace.

printf "\033]0;$*\007"
echo "Changed window title to $*"





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]