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

RE: gnome-terminal question



On Mon, Feb 12, 2001 at 07:09:24PM -0500, D-Man wrote:
> On Mon, Feb 12, 2001 at 02:19:20PM -0800, aphro@portal.aphroland.org
wrote:
> | 
> | hi
> | 
> | 
> | i was curious what needs to be done to get a remote host
> | (connected through ssh) to display the hostname and directory
> | in the titlebar of a gnome-terminal window. redhat systems
> | seem to do this but none of my debian systems do.
> | 
> 
> What I had done was make some launchers (shell scripts work as well)
> for each of the hosts I would connect to and use the command line to
> set the title.  (I think the opiton is -t) 

make it -T

> I think there is some (shell) command that can be used as well (from

yep, echo:) 

    $ echo -en "\033]0;My brand new title\007"

More from the list-archives (to be put in your ~/.bashrc file):

    # Following sets prompt to [userid@host dir], and puts the full
    #   user@host:/full/path/spec in an xterm title bar.
    function proml
    {
    case $TERM in
        xterm*|rxvt|eterm|wterm)
            local TITLEBAR='\[\033]0;\u@\h:\w\007\]'
            ;;
        *)
            local TITLEBAR=''
            ;;
    esac

    PS1="${TITLEBAR}\
    [\[\033[7m\]\u\[\033[0m\]@\h:\W]\
    \$ "
    PS2='> '
    PS4='+ '
    }


My question back is:
how the hell are you supposed to find such info?
nothing in term/info-cap.

same song, second verse... (oops, seems lookout isn't indenting right...)
actually, I found the info in "Xterm Control Sequences" by Edward Moy,
University of California, Berkley.  Revised by Stephen Gildea, X Consortium
(1994),  Thomas Dickey, XFree86 Project (1996-1999).
I went looking for this thing but I don't remember where I found it.
Just looked and found it in /usr/share/doc/xterm/ctlseqs.ms.gz.  You
have to run it through troff to print a copy.

some extra tidbits on bash...

settitle ()
{
   _whome=${_whome:="`whoami`@`hostname`"}
   echo -e "\033]2;$_whome ==> $PWD\007\c"
}

case $TERM in
xterm*|rxvt*)
   case $0 in
   -bash|bash)
      PROMPT_COMMAND=settitle
      PS1='$ '
      ;;
   *)
      PS1='^[]2;$_whome ==> $PWD^G^M$ '
      ;;
   esac
   ;;
*)
   PS1='$ '
   ;;
esac

Note that "^[" is esc, "^G" is bel, and "^M" is cr.  If you don't put the
cr at the end, your command line starts to scroll sidways some distance
before
the end of the screen.  The cr makes the shell reset counting characters
on the input line.  (Works with bash, anyway...)

hth
jim



-- 
groetjes, carel


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org



Reply to: