Detecting OS and Window Manager

Graham Ashton graz at mindless.com
Wed Jun 5 15:05:49 EDT 2002


On Wed, 05 Jun 2002 19:53:21 +0100, Andrew Wilkinson wrote:

> I'd like to know if
> they are running KDE or Gnome, does anyone know a (preferably) simple
> test for this?

I suspect your best bet is to resort to environment variables. I just
typed "env | grep -i gnome" and found out that (as I'm running GNOME) I
have an env variable called GNOME_SESSION_NAME (accessible via os.environ)

I've no idea how portable that is though. I'm running Ximian GNOME 1.4.

-- 
Graham



More information about the Python-list mailing list