6

I wrote the following .desktop file for my application named Qtag:

[Desktop entry] Name=Qtag Comment=Audio tag editor Exec=qtag Icon=/usr/share/pixmaps/Qtag.png Terminal=false Categories=Multimedia; Version=1.0 Type=Application 

I copied it to /usr/share/applications, but I still cannot find my app in the menu (I use KDE Plasma 5 application launcher). When I try to open the file in Dolphin (the KDE file manager), it says that there is no Type=... entry in the file. I use KDE Plasma 5. The executable and the icon are in the right places (qtag is in /usr/local/bin).

1
  • change [Desktop entry] to [Desktop Entry], note capital E. Commented May 10, 2015 at 19:03

3 Answers 3

6

The first line needs to be [Desktop Entry], with a capital E. Otherwise the file isn't recognized as a desktop entry. Dolphin is looking for the Type= line in the [Desktop Entry] section — this could use a more explicit error message!

You shouldn't put files under /usr (except under /usr/local), that's for your distribution. For your own desktop entry files, use ~/.local/share/applications.


If you put .desktop files in random places, they need to be executable — that's a security measure, to avoid accidentally running arbitrary code from files downloaded from the Internet. That doesn't apply if you put the file in a directory that's dedicated to destkop entry files such as /usr/share/applications or ~/.local/share/applications. You can add #!/usr/bin/xdg-open at the beginning to make the file a valid, executable script which will launch the application when executed.

3
  • Thank you for the answer. But there is no /usr/share/local/applications directory in my system. Should I create it, then? Commented May 10, 2015 at 19:11
  • @amethystAnt I never mentioned a directory /usr/share/local/applications. That's .local/share/applications (note the initial dot) from your home directory. Commented May 10, 2015 at 19:26
  • Adding on here that the .desktop file actually has to be in .local/share/applications or /usr/share/applications, symlinks will not work. (Even symlinks with an executable bit set.) Commented Apr 12, 2021 at 13:58
2

You can use the validation tool desktop-file-validate. It can find your typo and checks for more common mistakes.

$ desktop-file-validate qtag.desktop test.desktop: error: first group is not "Desktop Entry" test.desktop: error: file contains group "Desktop entry", but groups extending the format should start with "X-" 

(see also: How to validate/verify .desktop files?)

0

Also, "Multimedia" isn't a recognize mayor categorie in the spec (SEE: https://specifications.freedesktop.org/menu-spec/1.0/category-registry.html), coulbe left out from the menu file, there for that desktop file dont show becouse its not included in any rule.

Check the "***applications.menu" (in /etc/xdg/menus/ or HOME/.config/menus) , if use a rule like:

 <Include> <Category>Multimedia</Category> </Include> 

My two cents...

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.