Re: hostname in title of gnome-terminal



On Mon, Oct 16, 2006 at 12:31:20 +0200, John Que wrote:
>Hello,
>I have gnome-terminal-2.14.0-1 on FC5.
>Is there a way to configure it so that the hostname will be the title
>of an opened tab?
>
>I of course know about the "Set title" menu, but my question is : can
>it be done automatically so when I ssh to some machine , the title will
>be it's hostname (you can assume that I have the remote machine
>hostname before ssh into it).

I usually let my shell do that for me:

 bash:
  case $TERM in
  (xterm*)
	PROMPT_COMMAND='echo -ne "\033]0;${USER}($(id -ng))@${HOSTNAME}: ${PWD}\007"'
  ;;
  esac

 zsh:
  case $TERM in
  (xterm*)
	function precmd () { print -Pn "\e]0;%n($(id -ng))@%m:%~\a" }
  ;;
  esac

/M

-- 
Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
magnus therning org             Jabber: magnus therning gmail com
http://therning.org/magnus

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

The right to search for truth implies also a duty; one must not
conceal any part of what one has recognized to be true.
     -- Albert Einstein

Attachment: pgpE03xeFZT1a.pgp
Description: PGP signature



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