Relying on `Implements=` key should work, though I think the `ArgPrefix` should be part of the desktop file itself – it will be static and defined by the vendor. Also for the system to be efficient, DEs would want to add something like PCMan’s cache mentioned in the intents mail.

However, since `Implements=` is supposed to contain D-Bus interfaces [1], I would like to propose an alternative solution. We could define `org.freedesktop.TerminalEmulator` interface containing `Execute` method. This could be modelled after `org.freedesktop.Application` from D-Bus Activation section of desktop-entry-spec [2].

Similarly, there would be `org.freedesktop.Editor` interface containing `Edit` method, representing *Edit* intent, dual to the `org.freedesktop.Application`’s `Open` method, which would be interpreted as default *View* intent.

This would require modification of the programs but would offer a standard replacement to fiddling with the CLI flags. Since modern applications already should be D-Bus-activatable, it should be fairly simple addition (and most of the code would be handled by GLib or Qt anyway).

[1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.2.html#interfaces [2]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.2.html#dbus



On Wed, 29 Aug, 2018 at 11:41 PM, Ian Huang <[email protected]> wrote:
Huh, good find. I was about to type up an email about how the "Implements=" key that was added after that proposal is kind of useless in our case; as it says, "it is entirely up to the entity who defined a particular interface to define what it means to implement it." But then I realized that we can actually use it quite easily in addition to the proposed xdg-terminal-exec or xdg-intent-exec spec to avoid the need for duplicate desktop files for intent handlers.

It could work like this:
1. The X-ExecArg option (or X-ArgPrefix) in the proposed spec is moved from the "data" directories with desktop files to part of the .list "config" files; 2. the concept of "data" directories (the ones full of .desktop files) can be
   left out;
3. terminals and other applications that open intents are instructed to have certain values in the Implements key, for example "Implements=xdg-intent-
   terminal" or "Implements=xdg-intent-calculator";
4. when we scan through the .list config files, instead of running the matching app in the data directories, we check that the matching .desktop file in the usual place (/usr/share/applications/ or ~/.local/share/applications or
   whatever) has the correct intent named in the Implements= key;
5. we just run that desktop file with the ArgPrefix specified in the .list.

It's only a little cleaner, though. Thoughts?

_______________________________________________
xdg mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to