Desktop file spec improvements (was: Binary name in the desktop file)

David Faure faure at kde.org
Tue Dec 31 02:55:53 PST 2013


On Tuesday 31 December 2013 05:44:12 Ryan Lortie wrote:
> hi,
> 
> On Tue, Dec 31, 2013, at 5:39, David Faure wrote:
> > It is missing in many many
> > .desktop
> > files, but this means solving this doesn't require a change in the spec,
> > it
> > only requires everyone to add that TryExec key in most desktop files.
> 
> TryExec has a negative performance implication: you must do at least one
> stat call (and possibly several in the case that you are searching the
> path) in order to find out if the desktop file should be shown or not.
> With the desktop file index in place, this turns out to be the single
> most-expensive thing that we have to do when listing off all desktop
> files.  In light of this, I'd generally advise people to _avoid_ adding
> TryExec.

OK then we need a different key indeed :)

One that contains the name of the executable that has to be present on disk so 
that, *after* trying to launch a program and it fails, we can check if the 
binary actually exists, in order to give the user a proper error message.
This doesn't have the performance impact you mention, since it's only done on 
error, after the fact.

So I am in favour of a ExecutableFile=firefox which can be 
ExecutableFile=/usr/something/foo.jar or any other file that is required for 
running this desktop file.

But again, this is not something anyone should try to "execute" as is.
I hope the naming of the key is clear enough, otherwise a better name could be 
found.

Hmm, for the case of wine or java, there are actually two requirements,
wine/java and then the .exe/.jar. So maybe this could be
RequiredFiles=wine;/c/programs/foo.exe;
RequiredFiles=java;/usr/something/foo.jar;
and for simpler cases, of course,
RequiredFiles=firefox

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the xdg mailing list