KDE legacy menu directories

Thiago Macieira thiago at kde.org
Tue Nov 7 16:02:04 EET 2006

Jannis Pohlmann wrote:
>I had a short look at the structure of KDE legacy menus (located
>in /opt/lunar/kde/3/share/applnk/ on my machine) and I noticed that
>there are no ".directory" files (except in some ".hidden/"
>sub directories). What's the best way to handle legacy dirs for which
>this is the case (no ".directory" file)?
>If I have no ".directory" file, I can't display any useful information
>about a menu, right? The most obvious solution for such a menu might be
>ignoring it. What's your opinion on this?

Those are really legacy. As such, no new implementation should use them. 
KDE has also supported the non-legacy menus for quite a long time. So, 
unless you're developing an application that is targeted at very-old KDE 
releases (2.x time, for instance, more than 5 years old now), you don't 
have to bother with the legacy dirs at all.

The main difference between the legacy and the new style is that 
the .desktop files were placed directly in those directories. The 
applications were not categorised. By consequence, there was only one 
menu layout possible, and that was 1:1 with the directory structure.

The ".directory" file -- a file named .directory, not a file whose name 
ends in .directory -- is the KDE way of specifying information about a 
directory. Mainly, it was used to give a nicer name as well as 

>Another thing I noticed is that the applications.menu installed by KDE
>on my machine (I renamed it to /etc/xdg/menus/kde-applications.menu) is
>using <Directory> elements with content like "kde-main.directory". The
>root <Menu> is basically looking like this:
>  <Name>Applications</Name>
>  <Directory>kde-main.directory</Directory>
>  <KDELegacyDirs/>
>  <DefaultAppDirs/>
>  <DefaultDirectoryDirs/>
>I searched for "kde-main.directory" and found it in
>/opt/lunar/kde/3/share/desktop-directories/. This path obviously isn't
>listed anywhere in the specified directory dirs. To me this looks like
>KDE is expecting me (as the author of the menu implementation) to
>include $KDEDIR/share/desktop-directories/, but unless $KDEDIR/share/ is
>defined in $XDG_DATA_DIRS, there's no reason for this, IMHO.

Here, my $XDG_CONFIG_DIRS/menus/applications.menu has the same 
<Directory>kde-main.directory</Directory> as yours, but that file is 
found in $XDG_DATA_DIRS/desktop-directories.

In other words: $KDEDIRS/share must be included in $XDG_DATA_DIRS. This is 
automatic for KDE applications, but it should be considered a bug in your 
distribution if its scripts don't do that. Especially if $XDG_CONFIG_DIRS 
points to KDE files.

>The spec clearly maps <KDELegacyDirs> to "kde-config --path apps" and
><DefaultDirectories> to $XDG_DATA_DIRS/desktop-directories/. Is anyone
>able to explain *why* KDE does not respect this? 

It does.

kde-main.directory is installed in $XDG_DATA_DIRS, during installation. 
Extract from the Makefile.am:
xdg_directory_DATA = \
kde-main.directory \

And the applications.menu:
xdg_menu_DATA = applications.menu

The configure script defines:
  if test -z "$xdg_menudir"; then
  if test -z "$xdg_directorydir"; then

The problem is that your distribution put the KDE's application.menu in 
$XDG_CONFIG_DIRS, but the kde-main.directory out of $XDG_DATA_DIRS.

>I don't feel like 
>adding a workaround for this unless someone tells me a good reason for
>it - or adds $KDEDIR/desktop-directories/ to the menu spec, hehe.

Don't. It's a bug in your distribution. You should treat this as such: 
like any .menu file that specified .directory files that can't be found.

  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/xdg/attachments/20061107/222c17a1/attachment.pgp 

More information about the xdg mailing list