Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Detect Environment

by almut (Canon)
on Dec 09, 2009 at 16:49 UTC ( #811967=note: print w/ replies, xml ) Need Help??


in reply to Detect Environment

Maybe check -t STDIN  (would test if STDIN is opened to a tty) — see filetests


Comment on Re: Detect Environment
Download Code
Re^2: Detect Environment
by Crackers2 (Vicar) on Dec 09, 2009 at 17:01 UTC

    Another option is to check if the DISPLAY env var is set, and open up graphical if it is.

    I think that's the behaviour things like emacs use for example. It does mean that if you open a console from your GUI and then start the program from there, it'll open up with the GUI, which seems to be slightly different from what you describe although more intuitive.

    (Update: "You" in the above means the OP of course, not almut)

      Crackers2:

      FYI: It's a frequent case where you have a console window open on an XTerm. Then you'd be on a console, but you'd still have DISPLAY set.

      ...roboticus

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2014-09-19 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls