xdg-desktop-menu Install Locations; why /usr/local/share/ and not /usr/share/?
dyek at real.com
Wed Aug 19 12:22:42 PDT 2009
(1) I suppose xdg-desktop-menu is designed for 3rd. party app. to
install the .desktop file.
Which is the preferred directory to install 3rd. party app.'s .desktop file?
Should it preferably be /usr/share/applications/?
I noted a while ago that /usr/share/applications/ was used. However,
xdg-desktop-menu is now installing into /usr/local/share/applications/,
probably because /usr/local/share/ exists on the systems.
Also, this is from Desktop Menu Spec.:
If an application is intended to be installed by root on a system wide
basis then /usr/share is recommended to be used as value for datadir and
/etc/xdg is recommended to be used as value for sysconfdir. In case the
/usr/share hierarchy is not writable it is recommended to use
/usr/local/share as value for datadir instead.
XDG Base Directory Specification, though, shows this:
If $XDG_DATA_DIRS is either not set or empty, a value equal to
/usr/local/share/:/usr/share/ should be used.
This is what xdg-desktop-menu is doing:
If $XDG_DATA_DIRS is NULL, xdg_system_dirs is set to:
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/.
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.)
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
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.
(3) Is it a possibility to support running xdg-utils during
"debian/rules build" time and in %Install section of rpm spec. file?
More information about the xdg