Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!uwm.edu!linac!att!bu.edu!nntp-read!jc From: jc@raven.bu.edu (James Cameron) Newsgroups: comp.windows.open-look Subject: Re: xterm titles in olwm Message-ID: Date: 23 Apr 91 09:10:58 GMT References: <459@octelb.octel.UUCP> Sender: news@bu.edu.bu.edu Distribution: na Organization: What do you mean 'That *can't* be done????' Lines: 71 In-reply-to: jfd@octel.UUCP's message of 19 Apr 91 01:21:20 GMT >>>>> On 19 Apr 91 01:21:20 GMT, jfd@octel.UUCP (John F. Detke) said: jfd> I can't for the life of me get control sequences to alter the title of my jfd> xterms. I have RTFM, and the FAQ in comp.windows.x, but neither of those methods jfd> work. Any clues as to what I am doing wrong? If it matters, Sparc SunOS 4.1, jfd> openwindows 2.0. jfd> Thanks, jfd> jfd The following alias (for csh && tcsh) changes the title of the xterm to the current directory: if ($?TERM && $TERM == 'xterm') then alias cd 'cd \!*;xtitle " " $HOST": "$cwd" "' endif Now, save the appended program as xtitle.c somewhere in your path, and compile it as follows: $ cc -o xtitle xtitle.c You can also just do a $ xtitle Whatever-your-heart-desires to change it as well. Hope it helps! jc -- James Cameron (jc@raven.bu.edu) Signal Processing and Interpretation Lab. Boston, Mass (617) 353-2879 ------------------------------------------------------------------------------ "But to risk we must, for the greatest hazard in life is to risk nothing. For the man or woman who risks nothing, has nothing, does nothing, is nothing." (Quote from the eulogy for the late Christa McAuliffe.) -- Remove everything above and including this line and save to xtitle.c -- #include /* * This program takes the input string and puts it into the * the xterm title. If you change the value of the first * number in the printf statement, you can determine where * the string will go. You can use either 0, 1, or 2. 0 * puts it in the title of the xterm; 1 puts it into the * the icon name, and 2 does both. */ 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]0;%s%c", (char)27, buff, (char)7 ); fflush(stdout); }