In KDE 3.2 a common menu format is introduced at http://freedesktop.org/Standards/menu-spec/
Before KDE 3.2:
Directory structure under share/applnk
Directory structure represents menu structure
Each .desktop
file
represents a single application
It was difficult to rearrange the structure in KDE 3.2 so the new menu format:
Defines structure in a single .menu file
Is based on categories
is shared between GNOME and KDE
Supports applnk style menus as well
Example from applications.menu
:
<Menu>
<Name>Office</Name>
<Directory>suse-office.directory</Directory>
<Include>
<Filename>Acrobat Reader.desktop</Filename>
<Filename>kde-kpresenter.desktop</Filename>
<Filename>kde-kword.desktop</Filename>
</Include>
<Menu>
Menu entry with 3 applications:
/usr/share/applications/Acrobat
Reader.desktop
/opt/kde3/share/applications/kde/kpresenter.desktop
/opt/kde3/share/applications/kde/kword.desktop
.menu
files describing the
menu structure. The files are stored in $
and
KDEDIR
/etc/xdg/menus/etc/xdg/menus
. These store the
system-wide menu structure and are controlled by
$XDG_CONFIG_DIRS
. $
stores
user-specific changes to the menu structure and is controlled by
$HOME
/.config/menusXDG_CONFIG_HOME
. For more information, see http://www.freedesktop.org/Standards/basedir-spec.
.desktop
files describe the
applications and are stored in: $
,
KDEDIR
/share/applications/usr/share/applications
,
/usr/local/share/applications
. These are
the system-wide application .desktop
files which are controlled by
$XDG_DATA_DIRS
.
$
contains user-specific HOME
/.local/applications.desktop
files and user-specific changes. It is controlled by
$XDG_DATA_HOME
. For more information, see http://www.freedesktop.org/Standards/basedir-spec
.directory
files describing
the sub-menus are stored in: $
,
KDEDIR
/share/desktop-directories/usr/share/desktop-directories
, /usr/local/share/desktop-directories
.
These are the system-wide menu .directory
files, controlled by
$XDG_DATA_DIRS
. The user-specific changes are stored in $
.
These are controlled by $HOME
/.local/desktop-directoriesXDG_DATA_HOME
. For more
information, see http://www.freedesktop.org/Standards/basedir-spec
Example from applications.menu
:
<Menu>
<Name>Art</Name>
<Directory>suse-edutainment-art.directory</Directory>
<Include>
<Category>X-SuSE-Art</Category>
</Include>
</Menu>
Art
is the internal name for this
menu. suse-edutainment-art.directory
defines the
name and icon for this menu, and the menu includes all applications
that have X-SuSE-Art
listed as a category, e.g.:
Categories=Qt;KDE;Education;X-SuSE-Art
suse-edutainment-art.directory
defines the
name and icon for this menu:
[Desktop Entry] Name=Art and Culture Icon=kcmsystem
Applications not in the menu do not exist with regard to other applications or file associations: If you remove an application from the menu, KDE assumes you don't want to use it.
When applications are unwanted in the menu, either place them in
.hidden
menu or a dedicated menu with
NoDisplay=true
in the .directory
file
$
contains KDEDIR
/etc/xdg/menus/applications-merged/kde-essential.menu
which includes some
essential menus that are normally not shown in the KDE menu itself:
Control Center has a hidden Settings menu whose
contents are defined by kde-settings.menu
and
whose icon and name are defined by kde-settings.directory
Info Center has a hidden Information menu whose
contents are defined by kde-information.menu
and
whose icon and name are defined by kde-information.directory
.
Screensavers contains a hidden System/Screensavers menu,
whose contents are defined by
kde-screensavers.menu
and whose icon and name
are defined by
kde-system-screensavers.directory
.
$
contains:
KDEDIR
/share/desktop-directories/kde-system-screensavers.directory
NoDisplay=true
KDE continues to support old-style menus that are defined by
the directory structures in $
(system wide) and KDEDIR
/share/applnk$
(user specific). This is observed unless the HOME
/.kde/share/applnk.desktop
file has a Categories
= line. In that case the categories determine the location in the menu.
KSycoca caches menu structure and
information about all available applications. You can rebuild the
database with
kbuildsycoca4
. The database
which is built lives in /var/tmp/kdecache-${
.
It is automatically updated by KDED,
checked during KDE login, and KDED
watches for changes while logged in.USER
}/ksycoca
To disable watching for changes (since it may hurt over NFS) add
the following to kdedrc
:
[General] CheckSycoca=false
To force regeneration, run touch $
.KDEDIR
/share/services/update_ksycoca
KMenuEdit is aimed at a single user setup. Changes to menu
structure are saved to
~/.config/menus/applications-kmenuedit.menu
,
changes to applications are saved in ~/.local/share/applications/
and changes
to sub-menus (icon, name) are saved in ~/.local/share/desktop-directories/
. The
KIOSK Admin Tool uses KMenuEdit and copies the above changes to
profile- or system-wide locations.