XDG_CURRENT_DESKTOP

Michael Terry michael.terry at canonical.com
Thu Jul 14 08:36:14 PDT 2011


Hello!  I've seen the idea of a XDG_CURRENT_DESKTOP environment variable 
tossed around a few times on this mailing list, but I don't see it in 
any spec.

Historically, most desktop file parsing libraries were tightly tied to a 
desktop and were able to assume which XDG desktop they were in (e.g. 
libgmenu assumes 'GNOME').

However in Unity, it uses most of the same libraries but still wants the 
ability to respect OnlyShowIn=Unity.  So there's a need for those 
libraries to detect which desktop is running.  The easiest/quickest way 
is to use an environment variable like XDG_CURRENT_DESKTOP.

I have some ideas on how such a variable might work:

== Reading ==

If XDG_CURRENT_DESKTOP is not set in the environment at all or if set to 
the empty string, its value is undefined.  This is for backwards 
compatibility, so that parsing libraries can use whatever default 
environment they want (as is the case now).

If set to a non-empty string, use that as the XDG desktop name ('GNOME', 
'Unity', 'KDE', etc).  Do not try to validate the value, as this makes 
it difficult to add new desktops in the future.

It might be useful for debugging purposes to have a value that tells 
libraries to ignore OnlyShowIn and NotShowIn and just show everything.  
Maybe '*'?  Not clear this is worth it.

== Writing ==

It seems easiest to have the DM set XDG_CURRENT_DESKTOP.  How about 
adding a new DesktopName field in the XSession desktop file, like so:

DesktopName=LXDE

If this field is not found in the XSession desktop file, the DM should 
either not define the variable at all or set it to the empty string.

If this field is found in the XSession desktop file, the DM should set 
XDG_CURRENT_DESKTOP to its value, again without any attempt at validation.


Thoughts?
-mt


More information about the xdg mailing list