From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25218 invoked from network); 13 Dec 1999 12:08:15 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Dec 1999 12:08:15 -0000 Received: (qmail 29608 invoked by alias); 13 Dec 1999 12:08:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9015 Received: (qmail 29601 invoked from network); 13 Dec 1999 12:08:11 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: "Alexandre Duret-Lutz" , Subject: RE: PATCH: zftp xterm titlebar Date: Mon, 13 Dec 1999 15:08:03 +0300 Message-ID: <000a01bf4562$b5378750$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <7d3dt75et0.fsf@antares.l2i> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 > AB> BTW is it possible to get the current window title? > > I could print it with : > > $ echo '' > > But does someone know how to catch this in a shell script ? Is there > a better way than using script(1) ? > Quick'n'dirty bor@itsrm2% ./rt.zsh Title is: bor@itsrm2:~/test/zsh bor@itsrm2% cat rt.zsh #!/tools/bin/zsh typeset name stty -icanon -echo < /dev/fd/0 print -n "\033[21t" read -u0 -k 1 c ((#c == 27)) || exit read -u0 -k 1 c ((#c == 93)) || exit read -u0 -k 1 c ((#c == ##l)) || exit read -u0 -k 1 c while ((#c != 27)) { name[$#name+1]=$c read -u0 -k 1 c } read -u0 -k 1 c ((#c == ##\\)) || name=() print Title is: $name (For some reasons, neiter ##] nor ##\] worked) The problem is, output of dtterm appears as input to zsh. When you start new script (as in this case) tty mode is reset to it's default, that is line buffered and echoing input. The stty above is needed to turn off line buffer (else you would need to press CR) and to turn off echo. The stty seems to be needed even if you call the above from inside of your login shell. I have "frozen" tty; in general case you may need to save/restore tty settings. Hmm ... as stty is highly system-dependent, may be stty module would be very nice. /andrej