Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
P is for Practical
 
PerlMonks  

Re^2: How to Get XTerm Title

by NateTut (Deacon)
on Sep 03, 2009 at 21:41 UTC ( #793315=note: print w/ replies, xml ) Need Help??


in reply to Re: How to Get XTerm Title
in thread How to Get XTerm Title

That escape sequence is part of the XTerm control set. When I did echo ^[[21t; > STDOUT.txt 2> STDERR.txt I get nothing in either file, yet I can see the window title on the screen. Putty is returning it, but I can't seem to capture it.

Update: the first character of that control string is an ESC and I entered it by doing a Cntrl-v first then the ESC key.

Update: Corrected a typo


Comment on Re^2: How to Get XTerm Title
Select or Download Code
Re^3: How to Get XTerm Title
by afoken (Parson) on Sep 04, 2009 at 05:24 UTC
    When I did echo ^[[21t; > STDOUT.txt 2> STDERR.txt I get nothing in either file, yet I can see the window title on the screen. Putty is returning it, but I can't seem to capture it.

    It seems you did not read or at least did not understand my posting.

    PuTTY and any other terminal emulator returns answers to status queries on the same channel where it returns user input: STDIN. STandarD INput, not STDOUT, not STDERR. You see the answer on screen because the terminal handling code of your operating system works in echo mode and writes back everything coming in from the terminal back to the terminal. This happens in the kernel, in a layer below the file handle layer.

    Stupid example that lacks disabling echo and a reasonable reading routine:

    #!/usr/bin/perl -w use strict; $|=1; print "Press <Enter> now, as this is a very stupid demo!\n", "Note that echo is not turned off, so you will see the answer +here,\n", "even before perl has read it: ", "\x05"; # Ctrl-E -> tell Putty to identify itself my $id=<STDIN>; chomp $id; print "OK, your terminal answered '$id' to Ctrl-E.\n";

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Thank You! You are right I did not understand your original answer, the code example helped tremendously.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://793315]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (13)
As of 2014-04-23 20:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (554 votes), past polls