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:
- the innermost
scopedset on this thread — a host running several apps in one process wraps each app’s dispatch so its effects reach that app’s services; - the process default a runner installed with
install_default; 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§
- Accessibility
Inputs - Accessibility requests the host passes to the app at startup.
- Continuation
Metadata - Inert, app-owned resume projection sent only to the local shell.
- Host
Environment - Everything the host tells a
uiprocess about itself. - Host
Identity - Who this process is and which workspace it serves.
- Host
Paths - Where this process’s user files live.
- Host
Recorder - What a
HostServices::recordinghost was asked to do, and the answers it will give. - Host
Scope - Keeps a set of services
currenton this thread; seeenter. - Host
Services - Everything a
uiprocess may ask of its host. - InProcess
Secrets - Secrets in one map that lives as long as the provider, for hosts that keep nothing outside the process.
- Media
Session - 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.
- Runner
Diagnostics - Opt-in developer diagnostics for the runner and the toolkit.
- Secret
Store - One app’s secrets.
Enums§
- Notify
Error - Why a notification could not be shown, scheduled or withdrawn.
Traits§
- File
Picker - Host-provided file choosing and opening.
- Location
Provider - Host-provided device location.
- Media
Session Factory - Starts media-control sessions for players such as the
VideoPlayerwidget. - Media
Session Publisher - Receives player state for the host’s media controls.
- Notifier
- Host-owned user notifications.
- Screen
Capture Provider - Host-provided screen capture.
- Secret
Backend - A synchronous secret store for one process: the desktop backends,
SecretStore::memory, or a host’s own. Every call names the app. - Secrets
Provider - Opens an app’s secret store: the system’s, or a host’s own.
- Speech
Factory - 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
servicescurrenton this thread until the returned guard drops. - environment
- The host inputs for this process: the installed ones, else — with the
nativefeature — what the native runner reads from the process, else none. - install_
default - Install
servicesas 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
environmentfor 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 aLANGUAGElist such asde:en_US, whose first entry wins) as a language identifier.C,POSIX, empty and malformed values name none. - scoped
- Run
fwithservicesascurrenton this thread.