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)
In reply to Re^2: Detect Environment
by Crackers2
in thread Detect Environment
by igoryonya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |