Detecting OS and Window Manager

Sean 'Shaleh' Perry shalehperry at attbi.com
Wed Jun 5 22:41:21 CEST 2002


On 05-Jun-2002 Tim Hammerquist wrote:
> Andrew Wilkinson graced us by uttering:
>> I'm writing a program that integrates with a number of different OSes
>> and Window Managers (under Linux), but I need to check what the user
>> is running.  I know that...
>> 
>> import os
>> if os.name == 'nt':
>> 
>> will tell me they're running NT. But under Linux I'd like to know if
>> they are running KDE or Gnome, does anyone know a (preferably) simple
>> test for this?
> 
> Well, windowmanagers aren't as static as operating systems are.  It's
> actually possible to run more than one wm at a time.
> 
> In any case, I went and experimented with the various wms on my system
> and in all cases the $WINDOWMANAGER shell var was set to the full path
> of the running wm executable.  This appears to be the only consistent
> and reliable var in my environment; for instance, here's a dump of my
> wm-related vars:
> 

WINDOWMANAGER is not one I am familiar with -- is KDM or GDM setting it?  None
of the machines I looked at had it set.





More information about the Python-list mailing list