.desktop files and jgmenu?

Sometimes having issues with jgmenu and .desktop files.

Recently checked out Ghidra but it did not come with a launcher, so created ~/.local/share/applications/Ghidra.desktop and pasted the required lines into it. The .desktop file worked from PCManFM, but it was not shown in jgmenu. What fixed that, was moving that same .desktop file to ~/Desktop and ln -s Ghidra.desktop ~/.local/share/applications. Now it starts easily from jgmenu… weird.

One that I cannot get to work, is QCAD/CAM. If the .run installer is run, it works fine - a launcher is created (likely in /usr/share/applications) and everything just works. But I lost my (licensed) installer. I do have a (licensed) archive version - if instead that is extracted, either to ~/bin/qcadcam or /opt/qcadcam, and a correct .desktop file made for it, it never appears in jgmenu. The launcher works if manually double-clicked using PCManFM - it opens perfectly - just doesn’t appear in jgmenu.

Are there some rules as to which .desktop entries are shown in jgmenu?

I’ve been down a very long rabbit-hole chasing this problem… xdg-desktop-menu forceupdate, desktop-file-validate qcad-cam.desktop, arronax link editor, verify ownership, chmod +x, file or link to ~/Desktop, etc. The entrypoint for QCAD/CAM (/opt/qcadcam/qcad) is a script. Checked ownership and execute permission. Tried sh /opt/qcadcam/qcad and bash /opt/qcadcam/qcad. First line of the script is #!/bin/bash and second line is cd "${0%/*}" (per other help threads elsewhere about it.)

Why could it possibly be preventing this from appearing in jgmenu?

As a last resort, just tried exo-desktop-item-edit --create-new qcadcam, filled it out, and tested the .desktop in PCManFM - worked - but not listed in jgmenu. Any ideas would be much appreciated.

Of course, right after sending, it started working.

But, I’m not sure exactly how I got it to work… I was in the process of trying to edit the ~/Desktop/qcadcam.desktop using arronax, but it instead asked for the file to save (weird), and I left this as qcadcam. PRESTO - appeared in jgmenu… however… it wouldn’t run. Checking arronax again, the command was somehow changed to /home/me/Desktop/qcadcam.desktop? I can’t explain it. Changed to /opt/qcadcam/qcad and it now works from jgmenu.

Even more puzzling, now there are three qcadcam entries in PCManFM, but only a qcadcam.desktop and qcadcam.desktop~ file.

Edit: what I think happened is arronax instead created a new file instead of saving the existing file. That new file was bare-bones, and worked.

All of the relevant files were moved out of ~/Desktop until the issue was identified. The only file that worked was this:

[Desktop Entry]
Type=Application
Name=QCAD/CAM
Exec=/opt/qcadcam/qcad
Terminal=false
Hidden=false
Icon=qcad

So adding something else to this, perhaps a GenericName, Comment, or custom Icon, was preventing it from appearing in jgmenu. So if anyone else has this trouble, start with a totally bare-bones .desktop file.

Oh and, if the file is in ~/Desktop, a link needs to be created in ~/.local/share/applications.