http://www.perlmonks.org?node_id=811968


in reply to Re: Detect Environment
in thread Detect Environment

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)