Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Updating the Xterm title with every execution?



On 25 March 1999, Ryan Tennant writes:
 > Hello.  I am trying to update the Xterm title every time I execute an
 > application, script, etc.  To do this, it would seem logical that I have to
 > process the commands I enter at the command line before executing them.  Zsh
 > seems to offer some preprocessing functionality, but not so much that I can
 > ask it to preprocess command line information and then execute an arbitrary
 > command.

This certainly isn't a general solution to your problem, but I do
change the terminal title for some commands (and take care to restore
it upon others).

function print_banner {
         print -n "\e]0;$1\a"
       }

function chpwd() {
       banner="$(print -Pn '%n@%m - %55<...<%~')"
       print_banner "$banner"    
     }

     function vi     { print_banner $1; =vi $1; chpwd }
     function su     { =su $*; chpwd }
     function zsh    { =zsh $*; chpwd }
     function rlogin { =rlogin $*; chpwd }
     function rcmd   { =rcmd $*; chpwd }

-- 

Matthew Lovell                       voice: (970) 898-6264 
Hewlett-Packard WSL                    fax: (970) 898-2510 
3404 E. Harmony Rd. MS A0         location: 3UQ4
Fort Collins, CO 80528-9599         mailto:lovell@xxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author