desktop entry spec TryExec key

Patryk Zawadzki patrys at pld-linux.org
Fri Mar 23 13:06:59 PDT 2007


On 3/23/07, Brian J. Tarricone <bjt23 at cornell.edu> wrote:
> Hi all,
>
> We're revisiting our desktop menu implementation in Xfce, and I'm
> looking at some old hacks I put into the old implementation to sanitise
> the Exec and/or TryExec keys before using them.
>
> Regarding the TryExec key, what can I expect to find there?  Are the
> 'field codes' allowed in the Exec key also allowed in TryExec (I would
> think/hope not)?  How is quoting handled?  Same as Exec?
>
> Basically my question is this: can I take the value of TryExec and
> pass it unaltered to something like g_find_program_in_path() and expect
> that to always work?  If not, what are the problems with that?  The
> desktop entry spec says very little about TryExec.
>
> Also, I'm realising the desktop entry spec is very ambiguous as to how
> to even use TryExec:
>
> "File name of a binary on disk used to determine if the program is
> actually installed.  If not, entry may not show in menus, etc."
>
> What does 'used to determine' mean in this context?  Was the original
> intention that the TryExec program should actually be *executed* to
> determine if the program is installed (my assumption is no)?  Or is
> just verifying that the program exists, is in PATH, is exectuable, etc.
> all that's intended here?

I am not the author of the original spec but it does not make sense to
actually execute anything. Some programs may never return (waiting for
stdin), some might fork and detach.

The way I understand TryExec is that it's supposed to point to a
binary that is required for the entry to make sense (ie. work) in the
menus. If the binary exists (can be found in PATH), is executable and
the current user has rights to execute it, that should be enough.

Actually executing the binary might lead to multiple undesired results
and would give no additional information (when is running a GTK/Qt
application cosidered successful?).

-- 
Patryk Zawadzki
Generated Content



More information about the xdg mailing list