[comp.windows.x] How can program determine user environment?

lachman@arisia.Xerox.COM (Hans Lachman) (06/29/90)

I'm looking for a reliable way for C programs and/or
shell scripts (on Sun) to determine what desktop
environment the invoking user is in, so that it can
present to the user whatever user interface fits in
with his/her desktop.  Ideally, it can tell whether
the user is in SunView, OpenLook, Motif, TTY, etc.
If it can just tell whether the desktop supports
X window applications, that would help.  (Note:  If
there is a way to ping the X server, that might help,
but may be misleading on multi-user systems.)

I looked into environment variables (XSERVER, WINDOWID,
DISPLAY), but different window managers seem to use
them differently (olwm, twm, mwm, xnews, etc.), and
there seem to be variations among different users.

If there is a standard method for determining this,
please let me know.  Otherwise, a non-standard but
reliable method would help.  Please EMAIL ME DIRECTLY.
Thanks,

	Hans Lachman
	lachman@arisia.xerox.com