xdg-desktop-menu Install Locations; why /usr/local/share/ and not /usr/share/?

Michael Pyne mpyne at purinchu.net
Wed Aug 19 13:42:06 PDT 2009


On Wednesday 19 August 2009 15:22:42 Daniel Yek wrote:
> This is what xdg-desktop-menu is doing:
> If $XDG_DATA_DIRS is NULL, xdg_system_dirs is set to:
>   /usr/local/share/:/usr/share/
> The first writable directory is used.
> 
> So, if /usr/local/share/ is found, it is used, instead of /usr/share/!
> 
> It turned out that a distribution wanted us to always install the
> .desktop file into /usr/share/applications/.

The way I think of it is that if you were to download a software package, and 
compile it and install it yourself for the whole system to use you'd install 
to /usr/local.

On the other hand, distribution-provided software packages (like Red Hat RPMs 
or Ubuntu .debs) would be installed to /usr as it is part of the distribution 
and not just a local addon.

So a configure script you provide, along with other software installation 
tools, should default to a prefix of /usr/local if no other prefix is given.  
Distributions will still need a way to have the package install to /usr (well, 
install to any given path actually) in order to make the packages.  Normally 
the distribution handles this, but if you use a custom build setup with your 
software package then you'd need to provide a way to change where a package is 
installed to, either at configure time or at install time.

> Why xdg-desktop-menu doesn't appear to follow the Desktop Menu Spec.?
> Is it because the directory content in /usr/local/share/ can potentially
> shadow that from /usr/share/?
> (If so, the .desktop file installed to the user home directory also
> shadows the system directory and can be very confusing in some cases.)

Both of these cases are intentional.  /usr/local shadows /usr since it is a 
more specific software package (for the given system at least).  Home 
directory shadows /usr/local since it is yet again more specific (to a 
specific user now instead of system wide).

> I think I'm choosing to define
> XDG_DATA_DIRS=/usr/share/:/usr/local/share/ when running
> xdg-desktop-menu to get it to do what I need to do at this time.
> I want to be better informed if my action can cause some drawback in the
> desktop experience!?

I'd leave the default alone and make a note in your install files that it is 
required to set XDG_DATA_DIRS before installing (or, allow the user to provide 
a prefix and set XDG_DATA_DIRS yourself).  But I would not default to using 
/usr/share/:/usr/local/share/

> A few other questions...
> (2) Any idea why if this directory, /usr/share/desktop-directories/,
> isn't found on a system, xdg-desktop-menu will not work? Is that just a
>  bug? xdg-desktop-menu: No writable system menu directory found.

Does /usr/local/share/desktop-directories/ exist?  The error message means 
exactly what it says: There is nowhere to put the .desktop files meant to 
create a system-wide menu entry.

> (3) Is it a possibility to support running xdg-utils during
> "debian/rules build" time and in %Install section of rpm spec. file?

Not sure, you might have to Google this one.

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/xdg/attachments/20090819/27063d4b/attachment.pgp 


More information about the xdg mailing list