Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!wuarchive!uunet!bu.edu!bu-pub.bu.edu!jc From: jc@bu-pub.bu.edu (James Cameron) Newsgroups: comp.windows.x Subject: Re: how can I change the title in the title bar Message-ID: <71793@bu.edu.bu.edu> Date: 8 Jan 91 16:22:38 GMT References: <2996@ux.acs.umn.edu> Sender: news@bu.edu.bu.edu Reply-To: jc@bu-pub.bu.edu (James Cameron) Organization: Boston University Lines: 53 {COMMENT: Posted to Net as this is a common question and is always nice know. *8-) } Here is a C program that does it for you: #include main(argc, argv) int argc; char *argv[]; { char buff[512]; argv++; argc--; buff[0] = '\0'; while (argc--) { strcat( buff, *argv++ ); strcat( buff, " " ); } buff[strlen(buff)-1] = '\0'; printf( "%c]2;%s%c", (char)27, buff, (char)7 ); fflush(stdout); } Now, you can have 3 things happen. That first number in the printf is what determines where the excape sequence is executed. (ie. mine is a '2') A 0 will change the title and the icon name. A 1 will change the icon name. A 2 will change the title. Now, what is often done is to create an alias such that it shows the current directory in the title only. Here is how I did it: if ($TERM == 'xterm') then alias cd 'cd \!*;~jc/`arch`/xtitle " "$cwd" "' endif This could be put into your .alias file. The reason I did it using the alias is that first I check to see if first of all I am on a graphics computer. As I work on two different suns I have to directories with the compiled code in each. The `arch` is the architecture of the sun system. I am on sun3 and sun4. This allows one alias for either system. The $cwd is the current directory variable. Enjoy! jc