02 August 2006

Managing categories and menus in KDE 3.5

Ever felt like you K-Menu organises itself like a drunkard? Here is a little tip to force it to adapt to your wishes.
(Note: this is for a Gentoo install, the directory names might be slightly different on your distribution; play around with "locate" to find the correct ones)

if you create a myname.directory file in /usr/kde/3.5/share/desktop-directories, it will use the parameter Name specified in the file to automatically manage a category. You can then assign that category in the .desktop file of the applications (usually in /usr/share/applications or /usr/share/applnk ). It is reccomended (but not compulsory) to append a "X-" prefix to your category name if it's not one of the official KDE ones.

Once you have the .directory file in place and your .desktop files are properly tagged, you can add a directory to your K-Menu to contain those apps. The system-wide settings for kde menus are in /usr/kde/3.5/etc/xdg/menus. Brand new menus should be added to the "applications-merged" directory, to keep them separate from the standard KDE ones. An example menu file to manage the "database" category is this:
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"


Et voilà, you now have a new submenu that will automatically contain the applications tagged with your custom category. By the way, if you don't like some of the standard menus, the file to modify is "applications.menu".

If you then want to remove some of your pre-existing menu customization (made with the menu editor), the files are in ~/.local/share/desktop-directories e ~/.local/share/applications.

See this post on a kde list for another explanation.

No comments: