In KDE 3.2 a common menu format is introduced at
https://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
.menu
files describing the
menu structure. The files are stored in $
KDEDIR
/etc/xdg/menus
and
/etc/xdg/menus
. These store the
system-wide menu structure and are controlled by
$
XDG_CONFIG_DIRS
. $
HOME
/.config/menus
stores
user-specific changes to the menu structure and is controlled by
$
XDG_CONFIG_HOME
. For more information, see https://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
.
$
HOME
/.local/applications
contains user-specific .desktop
files and user-specific changes. It is controlled by
$
XDG_DATA_HOME
. For more information, see https://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 $
HOME
/.local/desktop-directories
.
These are controlled by $
XDG_DATA_HOME
. For more
information, see https://www.freedesktop.org/Standards/basedir-spec
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
$
KDEDIR
/etc/xdg/menus/applications-merged/
contains 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
.
$
KDEDIR
/share/desktop-directories/kde-system-screensavers.directory
contains:
NoDisplay=true
KDE continues to support old-style menus that are defined by
the directory structures in $
KDEDIR
/share/applnk
(system wide) and $
HOME
/.kde/share/applnk
(user specific). This is observed unless the .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
kbuildsycoca
. The database
which is built lives in /var/tmp/kdecache-${
USER
}/ksycoca
.
It is automatically updated by KDED,
checked during KDE login, and KDED
watches for changes while logged in.
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.