Where are backend files for application launchers?

Hi.

I want to add about 25 launchers in a new subfolder.
Have mostly figured out how to do it.

But when I create a new item, it goes into lost+found.
Putting the name of my new submenu in the item’s Categories does not help.
Not a problem, as I can simply drag it into my submenu in the Menu Editor.

However, I’d like to automate this menu creation (with a python script),
for which I’d need to know the backend file that joins the items to the submenus.

This is what I’ve found so far:

~/.local/share/desktop-directories/
~/.local/share/applications/
~/.config/menus/applications-kmenuedit.menu

The first two I was already working with, but I didn’t find the last one
until I used kfind to search for what had changed recently.

Looking at its contents (xml) it could be the real menu,
but the name suggests that it’s only for the editor,
it’s not the actual launcher menu.

On the other hand, in the whole home folder,
there was nothing else that could be the actual launcher menu.

So question 1 is:
Is ~/.config/menus/applications-kmenuedit.menu
an active part of the launcher apps (kicker and kickoff)
(i.e. it’s not only for the menu editor) ?

Question 1b is: Is that the whole picture?
With only the 3 files listed above, can I adequately control the menus?

If not, then question 2 is:
Can some kind soul tell us the paths of all the files that
contribute to the structure of the kicker/kickoff menus?

:slightly_smiling_face:

I got the basic info from the net and added the outline after much trial and error.

This is the .desktop file pointer list. I do not mess with the menu editor because of past mistakes, so I just modify any .desktop file to suit.

Hope this helps…

https://askubuntu.com/questions/674403/when-creating-a-desktop-file-what-are-valid-categories

=============================================

Categories=

Applications; IS NOTHING

SUB-HEADERS NEED THE MAIN HEADER

Development               -- Development;
    Translation           -- Development;Translation;
    Web Development       -- Development;WebDevelopment;
Education                 -- Education;
    Languages             -- Education;Languages;
    Mathematics           -- Education;Math;
    Miscellaneous         -- Education;  == WHEN AN ITEM IS PLACED UNDER Education ONLY, THE SUB-HEADER Miscellaneous IS CREATED WITH THE ITEM INSIDE ==
    Science               -- Education;Science;
Games                     -- Game;
    Arcade                -- Game;ArcadeGame;
    Board Games           -- Game;BoardGame;
    Card Games            -- Game;CardGame;
    Games for Kids        -- Game;KidsGame;
    Logic Games           -- Game;LogicGame;
    Tactics  Strategy     -- Game;StrategyGame;
Graphics                  -- Graphics;Viewer;Photography;
    More Applications     -- X-KDE-More;
Internet                  -- Network;FileTransfer;P2P;
    More Applications     -- X-KDE-More;
Lost Found                -- EITHER NO ENTRY OR ANY OF THE FOLLOWING ... Qt;GTK;GNOME;KDE;Motif;Java;ConsoleOnly;Robotics;Sports;ParallelComputing;Amusement;Documentation;Clock;Calculator;
Multimedia                -- AudioVideo;Audio;Video;Player;TV;
    More Applications     -- X-KDE-More;
Office                    -- Office;Viewer;
    More Applications     -- X-KDE-More;
Science  Math             -- Science; AND/OR Math;Physics;  == WITHOUT Education; THIS HEADER IS CREATED ==
Settings                  -- Settings;
System                    -- System;Compression;
    More Applications     -- X-KDE-More;
Utilities                 -- Utility;TextEditor;Accessibility;Documentation;
    More Applications     -- X-KDE-More;
SINGLES               -- Core;KDE;

Vektor

Thanks @vektor.

Some of the links have changed since then; now I find :
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
https://specifications.freedesktop.org/menu-spec/latest/

This is the file I was looking for:

$XDG_CONFIG_DIRS/menus/${XDG_MENU_PREFIX}applications.menu
This file contains the XML definition of the main application menu layout.

In Manjaro I get:

$ echo $XDG_CONFIG_DIRS
/home/jh/.config/kdedefaults:/etc/xdg
$ echo ${XDG_MENU_PREFIX}
plasma-

I found /etc/xdg/menus/plasma-applications.menu,
which looks like a base template; it has not changed for a few weeks.

So the editor menu ~/.config/menus/applications-kmenuedit.menu
still looks like it’s the one, although it’s path and name are not totally standard.

I’ll make another user profile to do some experimenting.
Will see what happens when I make changes in the kmenuedit.menu.

It was surprisingly easy.

I copied into the other user-profile my .directory and .desktop files
(into ~/.local/share/desktop-directories/ and ~/.local/share/applications/)
and a cut-down copy of my edit menu
(into ~/.config/menus/applications-kmenuedit.menu)

When I logged into the other profile, the start menu (launcher)
was all correct and it had my custom folder and items in it.

So the anwer to questions 1 and 1b is “yes” to both.
‘~/.config/menus/applications-kmenuedit.menu’
does control the launcher, it’s not only for the editor.

But it’s not the whole story; the system makes most of the menus,
and ‘applications-kmenuedit.menu’ does not normally exist.

Still, to add your own items, you only need
the 2 dirs and one file listed in my first post,
with .directory and .desktop files in the 2 dirs.
You don’t need to write anything in ‘applications-kmenuedit.menu’
other than your additional subfolder and items.

EDIT: First add an item by using the editor
(right-click the start button and ‘Edit Applications’)
then look at the files to get some idea of how to add more.

As far as I can tell kbuildsycoca6 runs as part of the session setup and it reads ~/.config/menus/applications-kmenuedit.menu and generates entries in ~/.config/menus/applications-merged/ - which is what the application launcher actually uses.

Thanks @guss77, that sounds reasonable.

But on my system (Manjaro stable) there is only one file in
~/.config/menus/applications-merged/’;
its name is ‘xdg-desktop-menu-dummy.menu’,
it’s completely empty, and was last modified 18 months ago.

In my testing user profile, that directory does not exist.

Thanks for reminding me of kbuildsycoca6.
I guess that’s what should be run after changing menu files, to make them take effect.
(So far, when testing, I logged out and back in.)