[Tutor] Testing for gui

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Nov 10 00:51:34 CET 2005


> I haven't written any code yet, but I was thinking I would like to test
> for either a windows environment (Is an X-Server running) or is this a
> strictly console (no X-server) environment and then do the appropriate
> thing for each environment. I am not sure that is any clearer, but I
> hope it is.

Hi Ken,

That makes sense.

Can you check to see if the DISPLAY environmental variable is set?  That
appears to be a fairly standard kludgy way to determine if the user is in
a graphical vs. non-graphical environment.  emacs, for example, appears to
check for DISPLAY before switching a terminal or X-Windows based UI.

Best of wishes!



More information about the Tutor mailing list