I have a couple of .desktop
files that aren't working as expected or not at all. I can't see any error anywhere and asking for help on each one seems unproductive. Is there a way I can verify that I'm using the correct syntax in the file, that it complies with the FreeDesktop standard, so I can apply specific fixes?
Asked
Active
Viewed 1.1k times
21

Braiam
- 35,991
1 Answers
29
You are looking for the desktop-file-validate
tool provided by the desktop-files-utils package in your distribution. It check for syntax, using reserved words/characters, in summary, that it complies with the Desktop Entry specification. Here's a example of a bad .desktop file:
➜ ~ desktop-file-validate asdf.desktop
asdf.desktop: error: value "cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*" for key "Exec" in group "Desktop Entry" contains a reserved character '&' outside of a quote
asdf.desktop: error: value "cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*" for key "Exec" in group "Desktop Entry" contains a reserved character '&' outside of a quote
asdf.desktop: error: value "cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*" for key "Exec" in group "Desktop Entry" contains a reserved character '$' outside of a quote
asdf.desktop: error: value "cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*" for key "Exec" in group "Desktop Entry" contains a reserved character '*' outside of a quote
asdf.desktop: hint: value item "GNOME" in key "Categories" in group "Desktop Entry" can be extended with another category among the following categories: GTK
asdf.desktop: error: value "GNOME;Oracle;Utility;Development;" for key "Categories" in group "Desktop Entry" contains an unregistered value "Oracle"; values extending the format should start with "X-"
asdf.desktop: hint: value "GNOME;Oracle;Utility;Development;" for key "Categories" in group "Desktop Entry" contains more than one main category; application might appear more than once in the application menu
asdf.desktop: error: value "s.0.m.t.h.i.n.g" for key "Version" in group "Desktop Entry" is not a known version
Which in good files like caribou-autostart.desktop
won't show anything.

Braiam
- 35,991
desktop-file-validate
may show no errors but still might not work at all due to an invalid entry onExec
. – Pablo A Apr 10 '20 at 06:27