XDG_CURRENT_DESKTOP

2011-07-14 Thread Michael Terry
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
___
xdg mailing list
xdg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xdg


Re: XDG_CURRENT_DESKTOP

2011-07-14 Thread Bastien Nocera
On Thu, 2011-07-14 at 11:36 -0400, Michael Terry wrote:
 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:

What's the use for this when you could add a set_desktop_name()
function in the front-end that uses that library?
Is it of any use apart from libgnome-menus?

___
xdg mailing list
xdg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xdg


Re: XDG_CURRENT_DESKTOP

2011-07-14 Thread Michael Terry

On 07/14/2011 11:42 AM, Bastien Nocera wrote:
What's the use for this when you could add a set_desktop_name() 
function in the front-end that uses that library? Is it of any use 
apart from libgnome-menus? 


Well, say there's an app FooBar that uses libgnome-menus.  How does 
FooBar know which desktop it's in?

-mt
___
xdg mailing list
xdg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xdg


Re: XDG_CURRENT_DESKTOP

2011-07-14 Thread Bastien Nocera
On Thu, 2011-07-14 at 11:46 -0400, Michael Terry wrote:
 On 07/14/2011 11:42 AM, Bastien Nocera wrote:
  What's the use for this when you could add a set_desktop_name() 
  function in the front-end that uses that library? Is it of any use 
  apart from libgnome-menus? 
 
 Well, say there's an app FooBar that uses libgnome-menus.  How does 
 FooBar know which desktop it's in?

Application FooBar being?

___
xdg mailing list
xdg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xdg


Re: XDG_CURRENT_DESKTOP

2011-07-14 Thread Michael Terry

On 07/14/2011 11:53 AM, Bastien Nocera wrote:
Application FooBar being? 


Off the top of my head, gnome-session-properties, gnome-control-center, 
and alacarte are all cross-desktop apps that would have an interest in 
knowing the desktop name to control desktop file parsing.


And those are just in GNOME.  Other desktops may have similar apps that 
want to know.  And some apps that aren't written yet may want to know.


If libgnome-menu were to add such a set_desktop_name() function, it 
would only kick the problem up one layer.  If that next layer happened 
to be the shell, then great, because shells *are* the desktop.  But 
otherwise it's not much help.


-mt
___
xdg mailing list
xdg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xdg


Re: XDG_CURRENT_DESKTOP

2011-07-14 Thread Nick Schermer
In Xfce XDG_CURRENT_DESKTOP is already used in a number of places as
an override for the default XFCE for {Only,Not}ShowIn. An example can
be found here [1]. The main purpose in our cases are mostly to make
the various parts of Xfce easier to use in other environments.

I think no library should ever assume it runs on a specific desktop,
but only provide the functions for an application to set this (in our
case garcon_set_environment).

Nick

[1] 
http://git.xfce.org/xfce/xfce4-panel/tree/plugins/applicationsmenu/applicationsmenu.c#n216
___
xdg mailing list
xdg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xdg