How does the menu categorize apps
Many Ubuntu based distros that use a traditional menu have categories. (accessories,graphics,internet, office, etc)
When I first saw these, I thought they were preset categories that someone manually made, but then I install an app like Microsoft Edge or Chrome, and I see the apps automatically in the internet category, I install grub customizer, and it’s automatically in the administration category, I install Gparted, and it’s automatically in the adminstarion category too.
I tested this on Linux mint, Xubuntu and Raspberry PI OS(I know it’s based on Debian not Ubuntu) I also believe that older versions of Ubuntu had the same thing.
My question is how does Linux know where to put new apps? Is it an online list of apps, or is it a local list in the os, or does the app I install contain one line of code that tells linux what category it should be in?
What is it that linux refers to?
An application comes with a
.desktop-file which includes a line with
The information in this line is used by files in
/etc/xdg/menus, these files define the organisation of the menu, directories, there order and which
.desktop-files should be displayed under a directory with a certain name.
Here an example, the
.desktop-file for Firefox has a line
and a file in
/etc/xdg/menus includes the following snippet:
It means that the directory
Internet in the menu should include
.desktop-files that have
Network in it’s
Categories=...-line which is the case for
You might have a bit different files in
/etc/xdg/menus than I and the corresponding snippet might be a bit different, it depends on your desktop environment, but with my example you can see how it works under the hood.