Re: Gnome-Terminal : smallf feature request
- From: Warren Young <tangent cyberport com>
 
- To: Gnome List <gnome-list gnome org>, tkennedy cyberport com
 
- Subject: Re: Gnome-Terminal : smallf feature request
 
- Date: Fri, 16 Jul 1999 01:50:46 -0600
 
James Henstridge wrote:
> 
> Changing the title to your cwd is not too difficult, and does not require
> any GTK+ programming.  Gnome-terminal understands the standard xterm title
> changing escape sequence.  So for bash, you might want to set your prompt
> to this:
>   PS1="\[\033]0;\u@\h: \w\007\]$PS1"
> 
> That will put user, host and directory in the title, and preserve your
> normal prompt.
I use the following, which comes from a recent Linux Journal on-line
article.  Put it in ~/.bashrc:
function setpromptstring {
    case $TERM in
        xterm*)
            local TITLEBAR="\[\e]0;\u@\h \w\007\]"
            ;;
        *)
            local TITLEBAR=""
            ;;
    esac
    PS1="${TITLEBAR}[\u@\h \W]\$ "
}
setpromptstring
It's a bit more complicated than what James suggests, but it has a few
advantages.  First, it's not as compact, so you can see the individual
pieces working.  Second, it uses the entire path for the window caption,
but a shortened path for the prompt string.  Third, it also works when
you're logged into a text-only screen, like the console, or a telnet
session; James' solution will trash your prompt string in those
situations.
The article I mention can be found at http://linuxjournal.com/issue64.
Enjoy,
-- 
= Warren Young, maintainer of the Winsock Programmer's FAQ at:
=     http://www.cyberport.com/~tangent/programming/winsock/
=
= ICBM Address: 36.8274040 N, 108.0204086 W, alt. 1714m
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]