Binary name in the desktop file
faure at kde.org
Sun Dec 29 01:27:22 PST 2013
On Thursday 26 December 2013 10:56:11 Jerome Leclanche wrote:
> I'd really like to be able to get the binary name from desktop files
> (eg a way to "start without any argument").
You didn't say why.
I don't think all programs can be started without arguments - your example
with "wine" is a good example of that. Other programs might do something
completely different when started without arguments, which might not be wanted
(but of course you could say that in that case they don't provide such a key,
and then they never get started without arguments....). So, maybe you need
this to be much more precise, if the intended use case is "start the program
and wait for it to register to DBus and then talk to it"... then the key in
the desktop file would be something like DBusActivationBinary=...
In fact, I could use a "binary name" key in desktop files, too, for the
following use cases:
* to extract the BIN= value for the startup notification standard (not sure
what this is then used for...). Seems at least to be used as default value for
the icon and for WMClass, if these are not specified.
* to check for "executable not found" when launching an executable from a
.desktop file and it fails (the process exits with an error code). When that
happens, I extract the binary name from the Exec line (yes, with all the
syntax pitfalls that this might have), look for it in $PATH, and if it can't
be found, I can then show a gui error message "Could not find the program
<foo>", which is much better than nothing happening at all from the user's
point of view.
A field for the executable name would make this more reliable.
This is a bit like TryExec, except that TryExec hides the desktop file if the
executable can't be found, which isn't always wanted (e.g. you don't want that
for an icon you explicitely added to your desktop or panel).
But note that my purpose isn't starting the executable without arguments, only
looking for it in PATH. So this one could be set for wine too, which is
another reason for the "dbus activation binary" to be separate from the
"here's the binary to check in PATH"....
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
More information about the xdg