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

Re: Eterm title magic?

On Tue, Dec 17, 2002 at 02:09:49PM -0500, Robert L. Harris wrote:
>   I know with "Eterm -T 'foo'" I can set the title for my Eterm, but is it
> possible to have it set to whatever is going on in my Term?  A co-worker
> using xterm has it set up so the title changes if he ssh's to a
> different box, etc.

In zsh, I have a prompt defined:
#based on prompt_suse_setup
prompt_setup () {
  PS1="%m:%~$ "
  PS2="> "

  prompt_opts=( cr percent )

  precmd () { 
       print -n "\e]2;$USER\@$HOSTNAME:$PWD\a\e]1;$USER\@$HOSTNAME\a"
  preexec () { }
prompt_setup "$@"

The precmd function is what sets the title bar and icon name.
In bash, I did a similar thing with this code:
if [ "$BASH" != "" ]; then
        if [ $TERM = 'xterm' ] || [ $TERM = 'rxvt' ]
                || [ $TERM = 'Eterm' ]; then
          PS1="\[\033]1;\h\007\033]2;\u@\h:$PWD\007\]\h:\w\$ "
          PS1="\h:\w$ "

The weird thing is that in zsh, I can't get the $TERM conditionals to
have any effect.  precmd() always ends up printing the escape sequence,
even if I'm at the console.  This results in an annoying beep.  If I log
in on the console, I end up manually running 'precmd(){}' to redefine
precmd to be an empty function.


| Web: http://web.morgul.net/~frodo/
| PGP Public Key: http://web.morgul.net/~frodo/mail.html 

Attachment: pgp9cxxd438B9.pgp
Description: PGP signature

Reply to: