Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

KDE Menu

How it Works

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

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

Stored Where?

.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

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

Common Pitfalls

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

Essential Menus

$ 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
    

Old-Style Menus

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

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

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.




 
 
  Published under the terms of the GNU General Public License Design by Interspire