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§
Constants§
- INTERFACE
- The interface of
PATH, with the one methodForward(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 underdev.daybrite.instance., and an overlong one is replaced by a hash under that prefix. - claim
- Claims
app_idfor this process, or forwardsargs(normallystd::env::args().skip(1)) to the process that already holds it.