Freedesktop

如何驗證/驗證 .desktop 文件?

  • June 15, 2018

我有幾個.desktop文件沒有按預期工作或根本沒有工作。我在任何地方都看不到任何錯誤,並且為每個錯誤尋求幫助似乎是徒勞的。有沒有辦法可以驗證我在文件中使用了正確的語法,它是否符合 FreeDesktop 標準,所以我可以應用特定的修復?

您正在尋找您的發行版中的desktop-files-utils 軟體包desktop-file-validate提供的工具。總之,它使用保留字/字元檢查語法是否符合桌麵條目規範。下面是一個錯誤的 .desktop 文件範例:

➜  ~  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

在好的文件caribou-autostart.desktop中不會顯示任何內容。

引用自:https://unix.stackexchange.com/questions/156892