Detecting XFCE environment from python code

David Mohr squisher at xfce.org
Mon Aug 10 18:50:52 CEST 2009


On Mon, Aug 10, 2009 at 7:04 AM, Aliaksandr
Stelmachonak<mail.avatar at gmail.com> wrote:
> 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.

Hi,
if you search the ML archive, this is a problem which has been
discussed a couple of times in the past.

As a quick summary, xfce is a list of components, and it is not clear
what part of Xfce defines an Xfce environment. If I recall correctly,
xfce4-session is probably the best indicator though.

~David



More information about the Xfce4-dev mailing list