KDBusService, Open and ActivateAction

David Faure faure at kde.org
Tue Nov 12 17:40:22 UTC 2013


On Tuesday 12 November 2013 17:27:31 Alex Merry wrote:
> On 12/11/13 17:17, David Faure wrote:
> > IOW, I would let the app handle this the way it wants.
> > It receives the command line, it gets the dbus calls via KDBusService, so
> > it can handle it all.
> 
> Which means we need a way to *let* the application deal with it like
> that.  As it stands, the application has a choice between duplicating
> the internals of KDBusService (to check whether it is the first instance
> or not) or not dealing with command line args passed to later instances.

Oh sure, we need a way to pass the command line to the running instance.

I wasn't talking about that, only about the support for actions.

> With that constraint, we either need to implement a CommandLine-like
> call (which means getting it added to the spec or adding our own
> extension interface), 

Yes.

> or restructure how K BusService is used so that
> the application can parse the command line args before creating it, and
> then tell it to make the correct D-Bus call if necessary.

I don't think the app should need to have code to make any dbus calls.

> I think the CommandLine call is probably the neatest solution (although
> it does mean the application has two different paths for dealing with
> command-line arguments). 

Yes, but of course this is usually desired to some extent (e.g. -geometry in a 
single-window application only makes sense for the first invocation),
and for anything that should be shared it's easy to make a function called in 
both cases.

> I'll email Ryan about getting it in the spec.

Actually, I think I remember now.

The glib implementation has that CommandLine method that I added in a comment.
We don't need it in the spec because it's an implementation detail.
KDBusService in "app 2" will call that in "app 1", so this is unrelated to 
cross-toolkit application launchers (which is the reason to have stuff in the 
spec in the first place).

If it fits our purposes, just uncomment that CommandLine dbus method, and use 
it to pass the args from app2 to app1?

One thing you might want to ask Ryan is what happens when typing "myapp" in a 
terminal and it's already running. Open(), or empty CommandLine().
(Do mention terminals explicitely to avoid confusion, his main use case is not 
that, but dbus-aware app launchers that use desktop files)

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



More information about the Kde-frameworks-devel mailing list