[lug] Gnome Terminal Dynamically-set title problem

Matt Thompson thompsma at jilau1.colorado.edu
Fri Jul 1 08:59:05 MDT 2005


On Thu, 2005-06-30 at 20:42 -0600, Dean Brissinger wrote:
> On Thursday, June 30, 2005 8:12 PM, Michael J. Hammel wrote:
> 
> > On Thu, 2005-06-30 at 19:45 -0600, Ferdinand Schmid wrote:
> >> You can configure it in the Edit Profile -> Title and Command tab to
> >> "Dynamically-set title:".  However, this only works for me when I ssh
> >> into a very old SuSE Linux machine.  Any of the newer machines must
> >> not return the proper status to the shell because my title update
> >> fails. 
> >
> > Most X terminals support escape sequences for this.  I've been doing
> > it like this for years in my .bashrc (or kshrc as the case may be): 
> 
> A T Cshell example here for a .cshrc:

And now for zsh, the shell of the gods.  This is just one of the
hojillion ways you can mess with your prompt with zsh.  Just search for
zshrc, zsh, prompt, etc., and you can find examples that have left- and
right-side prompts containing battery info for a laptop:

http://aperiodic.net/phil/prompt/

BTW, the characters shown as "^[" and "^G" are actual control characters
not those ASCII values.  Oh, and there is some cruft from when I had
more complex prompts and terminals that screen didn't alter the titlebar
with.

# Decide if we need to set titlebar text.
local TITLEBAR='%{^[]0;%m:%~ -- zsh^G%}'
local SCREENBAR='%{^[]0;%m:%~ -- zsh^G%}'
local BEGINNING_OF_LINE="%{^[[80D%}"


###
# Finally, the prompt.
case $TERM in
   xterm*|gnome*)
   export PS1="$TITLEBAR\
-- %m:%~ --\

> "
   ;;
   screen*)
   export PS1="$SCREENBAR\
-- %m:%~ --\

> "
   ;;
   *)
      export PS1="-- %m:%~ --\

> "
   ;;
esac

-- 
The mayfly lives only one day, and sometimes it rains. - Geo. Carlin
   Matt Thompson -- http://ucsub.colorado.edu/~thompsma/
   440 UCB, Boulder, CO  80309-0440
   JILA A510, 303-492-4662
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3355 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20050701/c4981966/attachment.bin>


More information about the LUG mailing list