Detecting XFCE environment from python code

Aliaksandr Stelmachonak mail.avatar at gmail.com
Mon Aug 10 15:04:31 CEST 2009


Hi all,

Here I want to clear out one problem, I faced recently. Problem is: detect,
what desktop environment is using from python code. Of course, using os
module is essential, but I want to do this check as much as possible
cross-platform. For KDE and GNOME this can be done by verifying if "special
variable" is in os.environ output. "Special variable" is KDE_FULL_SESSION
for KDE and GNOME_DESKTOP_SESSION_ID for Gnome. So I wonder, if there are
some "special variables" for XFCE, that are specific for this DE only? If
yes, what are they?

If there no such variable, please advice how to solve my problem. For now,
best solution I found is detecting if xfce4-session process is running. But
this require running ps command with parameters and parsing its output - not
very convenient and doesn't guarantee that this ps flags will work on
non-Linux systems.

Thanks in advance!

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20090810/c82c1816/attachment.html>


More information about the Xfce4-dev mailing list