I’ve just gone through hell and back to share this information with the world, thanks to a little help from phillw on freenode.
I was trying to determine where LXDE stores menu items for the applications menu, and wasn’t having any luck. But here’s what I found.
/usr/share/applications stores files called “.desktop” files. These files are a container for the actual application. They look similar to this:
[Desktop Entry]
Name=Adobe AIR Application Installer
Comment=Adobe AIR Application Installer
GenericName=Adobe AIR Application Installer
MimeType=application/vnd.adobe.air-application-installer-package+zip;
Exec="/usr/bin/Adobe AIR Application Installer"
Type=Application
Categories=Utility;
Terminal=false
Icon=AdobeAIR
/usr/share/desktop-directories contain .directory files. These files map the different “directories” you see in the applications menu between the many different languages supported. A single .directory file could look like this:
[Desktop Entry]
Comment=Desktop accessories
Comment[af]=Werkskermtoebehore
Comment[ar]=ﻢﻠﺤﻗﺎﺗ ﺲﻄﺣ ﺎﻠﻤﻜﺘﺑ
Comment[as]=ডেস্কটপৰ ব্যৱহৃত আনুষঙ্গিক বস্তু
Comment[be@latin]=Aksesuary stała
Comment[be]=Настольныя інструмэнты
Comment[bg]=Набор от помощни програми
Comment[bn]=ডেস্কটপের আনুসাঙ্গিক অ্যাপ্লিকেশন
Comment[bn_IN]=ডেস্কটপের ব্যবহৃত আনুষঙ্গিক বস্তু
Comment[br]=Mavegoù ar burev
Comment[ca]=Accessoris de l'escriptori
Encoding=UTF-8
Icon=applications-accessories
Name=Accessories
Name[af]=Toebehore
Name[ar]=ﻢﻠﺤﻗﺎﺗ
Name[as]=আনুষঙ্গিক
Name[be@latin]=Aksesuary
Name[be]=Інструмэнты
Name[bg]=Помощни програми
Name[bn]=আনুসাঙ্গিক
Name[bn_IN]=আনুষঙ্গিক
Name[br]=Mavegoù
Name[ca]=Accessoris
NoDisplay=false
Type=Directory
X-Ubuntu-Gettext-Domain=gnome-menus
Rest assured that there are approximately 40 other languages not listed here for the sake of brevity.
The final piece of the puzzle is the .menu files, stored in /etc/xdg/menus. I won’t include those here, because they could be massively different depending on your flavor of linux. These files contain the names of the directories that will be displayed, and a series of categories that are included/excluded. Categories you say? What are those used for?
The .desktop files, if you’ll notice, have a Category entry in them. This allows applications to be automatically included/excluded from a menu, without the user having to do too much.
The final piece of the puzzle was having user specific applications, in user specific folders. Those files live in ~/.local/share/applications, ~/.config/menus, and ~/.local/share/desktop-directories. Any of the files from the systemwide directories may be copied to the user-specific directories and modified, and will override whatever is in the systemwide directory. Just know that /usr/share/applications is overridden by ~/.local/share/applications, /etc/xdg/menus is overridden by ~/.config/menus, and that /usr/share/desktop-directories is overridden by ~/.config/local/share/desktop-directories, and you’ll be in business!
