Re: gnome-term



On Sun, Jan 13, 2002 at 11:35:34PM -0500 or thereabouts, akbara wrote:
> i'm not sure if this is the right list, but here it goes..
> is there anyway or for a future release for someone to put out a 
> patch where u could do something like gnome-terminal --local --title 
> whatim_working_on and it'd change the title of the terminal currently 
> in use, and keep it that way till u ran --title again ?
> 
> this would be really handy, esp for those of us that keep lots of 
> terminals open and multitask..
> 
> if it's already there apologies, but the closest i could find was 
> --title and that opens up a new one and the title changes when u cd..

gnome-terminal starts a new terminal, so that's not quite the
command you want. You can do this without writing a program by
using the xterm escape codes which gnome-terminal understands.
In xterm you can use these things to alter the titlebar.

First, you mention "the title changes when you cd". That is
not gnome-terminal doing that. That is something set up for
you to be "helpful". (I don't find it so.) It is probably 
something somewhere setting the PROMPT_COMMAND variable for 
you. Check your .(bash_)profile, /etc/profile or /etc/bashrc 
(or whatever is appropriate for your shell) and similar scripts. 
Look for something like this (the example is from RH):

    case $TERM in
        xterm*)
                if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
                else
                PROMPT_COMMAND='echo -ne "\033]0;${USER} ${HOSTNAME%% *}:${PWD/$HOME/~}\007"'
                fi
            ;;

I haven't noticed the first half before, so I presume that's something
new with 7.2. The second half is the bit you want.

If you are the only user on the machine, remove all that or comment it
out. This loses it for everyone, which may be anti-social if everyone
is more than "me", "me on a testing account", and "me running as root".
If you aren't, or you don't want to diddle with /etc files, set this 
PROMPT_COMMAND to nothing in your .bashrc. export PROMPT_COMMAND="" 
Then run "source .bashrc".

New gnome-terminals will now start with "Terminal" in the titlebar.
Well, if you start them from that terminal you resourced .bashrc
from at least.

Then read the ctlseqs.PS document from the XFree86 documentation
(it's in /usr/share/doc/XFree86*/xterm here). When you read it
you'll see why it's in PS format. It tells you how to do lots
of stuff you probably don't need to do, but it also tells you
how to get things into the titlebar and the icon for a window.

Then either memorise the things to press, or just steal this.
The second is easier. If you run bash, anyway. I can't remember
csh to know whether it will work there. 

#!/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 $*"

Stuff it in your home directory, chmod 755 it (or something
executable at least), ensure it's on your path, and then 
"titlebar plop", "titlebar Don\'t close this window" (it's not
very bright about ', # and a few other characters, I'm afraid)
and so on to your heart's content.

(Follow-ups probably should go to gnome-list or me; definitely
not to gnome-devel-list.)

Telsa



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