Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Dynamic Adaptation in size of Terminal!!!

by madtoperl (Monk)
on May 16, 2006 at 11:03 UTC ( #549712=perlquestion: print w/ replies, xml ) Need Help??
madtoperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!!!
I am working on a perl program which uses VT100 style escape codes and
runs in gnome-terminal or konsole or rxterm or xterm or similar.

I want to know if there is a way to sent an escape sequence to the
terminal emulator which queries for the current size of the screen and
gets a report back.
Do anybody have idea of how to do this?

2006-10-07 Unapproved by planetscape once evidence of habitual plagiarism uncovered.

Comment on Dynamic Adaptation in size of Terminal!!!
Re: Dynamic Adaptation in size of Terminal
by adrianh (Chancellor) on May 16, 2006 at 11:08 UTC
Re: Dynamic Adaptation in size of Terminal!!!
by Fletch (Chancellor) on May 16, 2006 at 12:35 UTC

    See also perldoc -q "screen size" for the underlying ioctl incantation if you don't have Term::ReadKey installed.

    And a bit of style advice: adding "!!!" to your titles doesn't make anyone want to answer them any more, and in fact will probably annoy people.

Re: Dynamic Adaptation in size of Terminal!!!
by sgifford (Prior) on May 16, 2006 at 13:00 UTC
    In addition to the advice from adrianh and Fletch, on many Unices you can catch the WINCH (WINdow CHange) signal to tell you that the user has resized your display area, and you should check the size again.
Re: Dynamic Adaptation in size of Terminal!!!
by vkon (Deacon) on May 16, 2006 at 16:01 UTC
    don't overuse '!!!', next time when you'll really need to emphasize, effectiveness of your exclamation marks will be lower.
Re: Dynamic Adaptation in size of Terminal!!!
by chargrill (Parson) on Oct 07, 2006 at 02:10 UTC

    These really aren't that tough to find.

    Please reference this link for the original question by a Mr. Jeff Silverman.

    I want to build a perl script that adapts dynamically to terminalsize I am working on a perl program which uses VT100 style escape codes and runs in gnome-terminal or konsole or rxterm or xterm or similar. I want to know if there is a way to sent an escape sequence to the terminal emulator which queries for the current size of the screen and gets a report back. Does anybody know how to do this? Many thanks, Jeff Silverman

    This is ridiculous.



    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (16)
As of 2014-12-19 17:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (90 votes), past polls