The TryExec field in .desktop files

desktop

I have searched a great deal and have been unable to find an answer to this. What does the TryExec field do in .desktop files? How does it differ from the Exec field?

Best Answer

According to standards.freedesktop.org, the TryExec entry takes the following:

Path to an executable file on disk used to determine if the program is actually installed. If the path is not an absolute path, the file is looked up in the $PATH environment variable. If the file is not present or if it is not executable, the entry may be ignored (not be used in menus, for example).

Desktop Application Autostart Specification states:

A .desktop file with a non-empty TryExec field MUST NOT be autostarted if the value of the TryExec key does NOT match with an installed executable program.

Unlike Exec and despite the similar name, TryExec does not actually execute it's value.

Related Question