Skip to main content

Module instance

Module instance 

Source
Expand description

Single-instance apps over the session bus, for backends whose toolkit does not provide it (GTK has GApplication; Qt has nothing).

The first process to claim an app id owns a bus name derived from it and exports /dev/daybrite/Instance. A later launch finds the name taken, forwards its command-line arguments to the owner through dev.daybrite.Instance.Forward(as), and gets Claimed::Forwarded back, at which point it exits. Reusing the app id as the bus name is safe because a process runs one toolkit, so it never also holds GTK’s GApplication name.

Structs§

Claim
This process’s ownership of an app id. Dropping it releases the name, so the next launch becomes the owner.

Enums§

Claimed
Why claim did not make this process the owner.

Constants§

INTERFACE
The interface of PATH, with the one method Forward(as).
PATH
The object the owning instance exports.

Functions§

bus_name
Turns an app id into a legal well-known bus name: characters outside [A-Za-z0-9_-] become _, an element that is empty or starts with a digit gains a leading _, an id with a single element is put under dev.daybrite.instance., and an overlong one is replaced by a hash under that prefix.
claim
Claims app_id for this process, or forwards args (normally std::env::args().skip(1)) to the process that already holds it.