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

Thiago Macieira thiago at
Sun Dec 29 05:05:49 PST 2013

On domingo, 29 de dezembro de 2013 11:15:23, Jerome Leclanche wrote:
> I remember TryExec now. TryExec partly fits one of my needs, although
> there remains the issue of starting without args.
> Starting without args is something a lot of xdg implementers do:
> Menus, application runners, launchers... All of these assume that
> %F/%f/%U/%u can safely be replaced by an empty string. We all know
> this isn't always the case. Now, can "this isn't the case" be
> considered an application bug? Let's put it this way: would you be
> comfortable telling people "The entire way your application is run
> (possibly even on all platforms you support) is broken because the xdg
> spec wants it this way"?

Maybe we can fix this in another way, for most of the cases. Not all, though.

Suppose we have:

Exec=appname --file=%f

If this .desktop file is present in the menu, it will be launched by running on 
the command-line:
	appname --file=

Which may or may not do the right thing. The right thing might be to run 
withou the --file= argument. We have three choices here:

1) declare that "text%f" should be removed if %f is also empty
  => drawback: in some cases, we may want to keep the text
  => question: do we even recognise the %f for expansion if it's not 
      surrounded by spaces?

2) extend the syntax, such as: %{f+--file=%f}, similar to a shell expansion
  => solves the drawback above but doesn't catch the corner case below

3) add a completely separate desktop keyword for running with no files, like we 
have done for TryExec.
 => advantage: supports weird things like:
Exec=appname --open --file=%f
ExecNoArgs=appname --newproject

(although we could also "uglify" the syntax and do:
  Exec=appname %{f+--open --file=}%{f---newproject})

Jerome, is the #3 case what you're aiming for? And do you have a concrete 
example that requires it?
Thiago Macieira - thiago (AT) - thiago (AT)
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the xdg mailing list