You are not logged in.

#1 2009-06-13 05:28:57

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

[SOLVED] Eterm Window Title

So I've just moved over to Arch after 6 years of Gentoo, so far so good (mostly).  big_smile

However I can not for the life of me figure out how to get the window bar, at the top of the terminal, to show like it did in Gentoo. In Gentoo the window bar for Eterm showed - 'user@host:/current/working/directory'; while now in Arch it shows 'Eterm'.  I have gone into the theme.cfg file and compared between the two systems (since I still have the backups from my Gentoo install) and this is what it shows (only the revelant part):

begin attributes
    title ishikawa@localhost:~     
    name Eterm 0.9.5
    iconname ishikawa@localhost:~

Now somehow this renders as 'ishikawa@section9:/current/working/directory'.  If I put that EXACT same code into the file on my new Arch install it renders as 'ishikawa@localhost:~'; literally showing what is put in the file.  So, doing this test I am guessing that somewhere Gentoo renders something different than Arch .... anyone know what that is or even if that is what it is?

Both systems were/are using Fluxbox; and considering that Gentoo always did this, I can't imagine that it's a version thing.

Thanks in Advance!

Last edited by lifeafter2am (2009-06-13 16:26:34)


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#2 2009-06-13 12:27:29

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] Eterm Window Title

I don't think that the problem is with Eterm being different between gentoo and arch.
It's your shell that set's the title.
Here's a page that describes it, along with examples for various shells.

http://www.faqs.org/docs/Linux-mini/Xterm-Title.html

It's specifically for Xterm, but all you need to do is change the case part for others, and it should work.
Here's the part for bash:

exerpt from How to change title of an xterm wrote:

4.3 bash

bash supplies a variable $PROMPT_COMMAND which contains a command to execute before the prompt. This example sets the title to username@hostname: directory:

    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'

where \033 is the character code for ESC, and \007 for BEL.

Note that the quoting is important here: variables are expanded in "...", and not expanded in '...'. So $PROMPT_COMMAND is set to an unexpanded value, but the variables inside "..." are expanded when $PROMPT_COMMAND is used.

However, $PWD produces the full directory path. If we want to use the ~ shorthand we need to embed the escape string in the prompt, which allows us to take advantage of the following prompt expansions provided by the shell:

    \u          expands to $USERNAME
    \h          expands to hostname up to first '.'
    \w          expands to directory, replacing $HOME with '~'
    \$          expands to '$' for normal users, '#' for root
    \[...\]     embeds a sequence of non-printing characters

Thus, the following produces a prompt of bash$ , and an xterm title of username@hostname: directory:

    case $TERM in
        xterm*)
            PS1="\[\033]0;\u@\h: \w\007\]bash\\$ "
            ;;
        *)
            PS1="bash\\$ "
            ;;
    esac

Note the use of \[...\], which tells bash to ignore the non-printing control characters when calculating the width of the prompt. Otherwise line editing commands get confused while placing the cursor.


Knute

Offline

#3 2009-06-13 16:26:11

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: [SOLVED] Eterm Window Title

Awesome man!  Chaning my .bashrc to look like this:

case $TERM in
    Eterm*)
        PS1="\[\033]0;\u@\h: \w\007\][\u@\h \W]\\$ "
        ;;
    *)
        PS1='[\u@\h \W]\\$ '
        ;;
esac

did exacly what I needed it to.

Totally didn't even think to look there.  Thanks again!  big_smile


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

Board footer

Powered by FluxBB