Detecting OS and Window Manager

Darren Winsper dw133 at
Fri Jun 7 01:34:30 CEST 2002

In <mailman.1023304388.9659.python-list at>, Sean 'Shaleh' Perry

> the only fool proof way to detect KDE, GNOME, etc is to check for X atoms.  The
> bigger question is why do you care?  As long as they can display a GUI you
> should not be bothered about which one it is.  Especially under the X Window
> System it was designed so that random applications DIDN'T know what they were
> running under.

As the person writing the KDE front-end to the mentioned application, let
me answer your question.  The idea is that if the user is running KDE,
then they get a KDE front-end by default.  I also hope that should
somebody write a GTK/GNOME front-end, if the user was running GNOME they
would get a GTK-based front-end by default.  It's good UI design.

> Also remember KDE is not a window manager, it is a desktop environment.  It is
> perfectly reasonable to run KDE and use fvwm (or even twm) as the window
> manager.  Same applies to GNOME.

OK, Andrew meant DE instead of window manager, but it's still a valid

> Also, what about someone who only runs say
> Window Maker and never uses GNOME or KDE?

Well, in that case we just choose a default.  The thing is, we want to
detect if PyKDE is installed.  If it is, then we can do "import kdecore"
without risk of it throwing an exception.  If it isn't, I'd rather not
have to try something along the lines of attempting "import kdecore" and
then having to catch an exception if it's not found.

ICQ: 8899775 Jabber ID: darren at
Stop the EUCD before it's too late:

More information about the Python-list mailing list