[Tutor] Checking the desktop environment

Timo timovwb at gmail.com
Fri Jun 20 09:39:51 CEST 2008


Hello all, in my program I need to know what desktop environment the
user is running. I figured this piece of code works, but apparently not
on every Linux distro. On Ubuntu it did the trick, but then I heard of
someone who runs SLiM that he get's an error with this.

if os.environ['DESKTOP_SESSION'].startswith('kde'):
    print "Running KDE"


So, does anyone know a water-proof solution for desktop environment
checking?

Timo


More information about the Tutor mailing list