Skip to main content

Module host

Module host 

Expand description

Host services — the capabilities a ui process borrows from whatever is hosting it.

Widgets and apps reach the clipboard, file choosers, URI handlers, speech, notifications and media controls through HostServices instead of calling a platform API directly. The same toolkit then runs under the native desktop runner, inside a multi-app host such as the compositor, or in a test that records every effect instead of performing it.

§Resolution

current answers, in order:

  1. the innermost scoped set on this thread — a host running several apps in one process wraps each app’s dispatch so its effects reach that app’s services;
  2. the process default a runner installed with install_default;
  3. HostServices::null, which performs nothing outside the process.

The existing free functions (text_selection::clipboard_copy, portal::PickRequest::send, widget::try_open_external_url, …) resolve through current, so apps need no changes. New code that holds a ui::application::HostContext can use its services() directly.

Modules§

environment
Host inputs — who the process is, where its files live, and how its user asked to be served.

Structs§

AccessibilityInputs
Accessibility requests the host passes to the app at startup.
ContinuationMetadata
Inert, app-owned resume projection sent only to the local shell.
HostEnvironment
Everything the host tells a ui process about itself.
HostIdentity
Who this process is and which workspace it serves.
HostPaths
Where this process’s user files live.
HostRecorder
What a HostServices::recording host was asked to do, and the answers it will give.
HostScope
Keeps a set of services current on this thread; see enter.
HostServices
Everything a ui process may ask of its host.
InProcessSecrets
Secrets in one map that lives as long as the provider, for hosts that keep nothing outside the process.
MediaSession
A live media-control session: commands from the host (media keys, a now-playing widget) and the sink the player publishes its state into.
Notification
One user-visible notification.
RunnerDiagnostics
Opt-in developer diagnostics for the runner and the toolkit.
SecretStore
One app’s secrets.

Enums§

NotifyError
Why a notification could not be shown, scheduled or withdrawn.

Traits§

FilePicker
Host-provided file choosing and opening.
LocationProvider
Host-provided device location.
MediaSessionFactory
Starts media-control sessions for players such as the VideoPlayer widget.
MediaSessionPublisher
Receives player state for the host’s media controls.
Notifier
Host-owned user notifications.
ScreenCaptureProvider
Host-provided screen capture.
SecretBackend
A synchronous secret store for one process: the desktop backends, SecretStore::memory, or a host’s own. Every call names the app.
SecretsProvider
Opens an app’s secret store: the system’s, or a host’s own.
SpeechFactory
Creates the speech output the built-in screen reader narrates through.
UriOpener
Hands a URI to whatever the host registers as its handler.

Functions§

current
The services effects on this thread should reach right now; see the module docs for the resolution order.
enter
Make services current on this thread until the returned guard drops.
environment
The host inputs for this process: the installed ones, else — with the native feature — what the native runner reads from the process, else none.
install_default
Install services as this process’s default, replacing any earlier one.
install_default_if_unset
Install make() as the default unless one is already installed. Returns whether it installed.
install_environment
Install environment for this process, replacing any earlier one.
installed_default
The installed default, if a runner installed one.
parse_posix_locale
A POSIX locale value (de_DE.UTF-8, or a LANGUAGE list such as de:en_US, whose first entry wins) as a language identifier. C, POSIX, empty and malformed values name none.
scoped
Run f with services as current on this thread.