Can't use certain built-in menu categories

If there’s a menu editor out there that actually works for Xfce, I’m all ears. menulibre and alacarte are basically grub-customizer for menus, so please don’t recommend those.

Here’s the current issue: I’m trying to use default XDG menu categories/sub-categories. Some of them work out of the box - Education and Science are used by LibreOffice, and I can add other applications there without a problem.

Here’s an example of a manual entry I created that works:

[Desktop Entry]
Version=1.1
Type=Application
Name=Python Docs
Icon=vivaldi-koejhimkfnihmafddfiefnnbiaggaodc-Default
Exec=/opt/vivaldi/vivaldi --profile-directory=Default --app-id=koejhimkfnihmafddfiefnnbiaggaodc
Actions=
Categories=Development;
StartupWMClass=crx_koejhimkfnihmafddfiefnnbiaggaodc

However, if I try to use Finance (sub-category of Office), the menu entry gets dumped into Other. I’ve been referencing this list, which should be the official one: https://specifications.freedesktop.org/menu-spec/1.0/category-registry.html. What’s even stranger is that every menu entry in Internet is using Categories=Network;, which makes even less sense.

In my opinion, Linux screwed the pooch on this. A simple directory structure like this

start menu
    --> Applications
    --> Games
    --> Office
        --> Finance
        --> etc.

would be a 1000x easier to manage. Yes, this is one thing that MS got right.

This maybe a PEBCAC problem :joy: .
The linked protocol spec says:

The Related Categories column lists one or more categories that are suggested to be used in conjunction with the Additional Category.
Note that at least one Main Category must be included in the desktop entry’s list of categories.
If multiple Main Categories are included in a single desktop entry file, the entry may appear more than once in the menu.
If the Related Categories column is blank, the Additional Category can be used with any Main Category.

My interpretation is that you NEED to also add the Main Category to the list of Categories in the desktop file.

Categories=Office;Finance;

There is no Internet category. It is just a pretty name for Network, actually its Name key.

grep "^Name" /usr/share/desktop-directories/Network.directory 
1 Like

I saw that after I took a closer look at the specs. I’m still trying to figure out why there are sub-categories at all when they are never displayed, at least on none of the distros I’ve ever installed. The closest I’ve seen is with KDE; its menu editor actually lets you create desktop entries in a sub-category. But they are still only displayed in the main one.

Again, it’s frustrating as hell that Windows can get this right, and way simpler than Linux. Maybe this is another case of Linux documentation being sub-par.

I don’t think it’s the distro that decides this, as I think it’s the menu itself.

I’ve seen them used before, but it depends on the menu you are using. Cinnamon, KDE, Xfce, and maybe Pantheon have multiple app menus, and they can all be customised.

I can’t remember which one has this feature, but I remember one in particular that allows you to turn off sub-categories — something like “flatten subcategories”.

It’s not the distros’ job to do this. It’s the menu developer that implements the menu specification.
It depends on what menu you are using. KDE, Gnome, LxQt, rofi, etc.

Specification/protocols, Documentation, Implementation, or a combination of them.
Linux, by design, is not a single organization/company. This carries on pros and cons. Users choose what fits their priorities. :man_shrugging:

I think I’m starting to understand the menu system better, although the docs are still confusing. Gonna go back to square-one, where I had a couple of custom categories working before menulibre borked them.

Thanks for everyone’s input.

2 Likes