Convenience API for unique apps
hp at redhat.com
Thu Jul 22 14:36:12 PDT 2004
On Wed, 2004-07-21 at 19:58, Mike Hearn wrote:
> A common use case for activation systems is to make apps single
> It would be nice if libdbus had a simple API to automate this common
> For instance:
> DBusConnection *connection =
> Which connects to the bus, checks if the given service name has been
> acquired and disconnects + exit(0) if so, otherwise it's up to you to
> release the connection.
That isn't usually the right thing though, is it? Most single-instance
apps should open a new window in the existing instance, or at least
bring the current instance to the front, rather than exiting.
I do want a "KUniqueApplication" type of solution but it's pretty hard
to get right (see the mess in gnome-terminal...) mostly because of
command line options that can't be applied per-window or dynamically.
I guess strictly speaking we need to require that all command line
options make sense for a new window or for an already-running window in
desktop applications. In other words command line options should all
translate to parameters to a window_new() function.
Another complexity is per-display apps, somewhat different than single
instance (single instance really means "scope of the bus" e.g.
per-session). I wanted to do per-display by setting a globally unique
value in a property on each display, then including that value in the
service name. So making that convenient would have to be done in the GUI
Anyway, this is definitely a valuable area of hacking, I just wanted to
bring up some of the complexities. ;-)
More information about the dbus