zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "Alexandre Duret-Lutz" <alexandre.duret@greyc.ismra.fr>,
	<zsh-workers@sunsite.auc.dk>
Subject: RE: PATCH: zftp xterm titlebar
Date: Mon, 13 Dec 1999 15:08:03 +0300	[thread overview]
Message-ID: <000a01bf4562$b5378750$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <7d3dt75et0.fsf@antares.l2i>

>  AB> BTW is it possible to get the current window title?
>
> I could print it with :
>
> $ echo '^[[21t'
>
> 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


  reply	other threads:[~1999-12-13 12:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-10 16:06 Clint Adams
1999-12-10 19:38 ` Alexandre Duret-Lutz
1999-12-12 10:44   ` Andrej Borsenkow
1999-12-13 10:13     ` Alexandre Duret-Lutz
1999-12-13 12:08       ` Andrej Borsenkow [this message]
1999-12-14 11:15         ` Oliver Kiddle
1999-12-23 11:50   ` Alexandre Duret-Lutz
1999-12-12 11:51 ` Andrej Borsenkow
1999-12-12 23:02   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000a01bf4562$b5378750$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=alexandre.duret@greyc.ismra.fr \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).