Skip to main content

Module portal

Module portal 

Source
Expand description

xdg-desktop-portal RemoteDesktop/ScreenCast session: streams and input for hosts without the privileged Wayland protocols. xdg-desktop-portal client: one RemoteDesktop (or ScreenCast) session on the session bus that hands out the PipeWire streams of the host’s monitors and takes input events for its seat. Compositors without the privileged wlroots protocols (GNOME, KDE) expose both only this way, through their portal backend, so this is the rung host capture falls to when the registry lacks capture or virtual-input globals.

Every portal call that ends in a Response signal is made through [PortalSession::request], which subscribes to the request object the portal will answer on before calling, as the handle-token convention requires; a consent dialog the backend shows blocks that call until the user answers. Input notifications go to an input thread of the session’s own, so no caller waits on the bus round trip, and it makes each once the one before it is answered: the frontend handles every method call on a thread pool, so two in flight together reach the backend in either order (a click’s release before its press, which leaves the button held). Each public call runs its async zbus calls to completion with [zbus::block_on] on the calling thread; between calls zbus drives the connection from a helper thread of its own, so a Response that lands meanwhile is queued for the stream that subscribed to it. A restore token the backend hands back is kept under the user’s state directory, so a session reopened to change the cursor mode, and every later start on this machine, needs no second consent; a backend that hands out none (KDE) shows no dialog to an unsandboxed app in the first place.

Structs§

PortalSession
A started portal session: its streams, the devices it may drive, and the token that restores it without a dialog.
PortalStream
One monitor stream the portal started: its PipeWire node and, where the backend says, its logical position and size in the compositor’s coordinate space.

Constants§

CURSOR_EMBEDDED
CURSOR_HIDDEN
CURSOR_METADATA
DESKTOP 🔒
DESKTOP_PATH 🔒
DEVICE_KEYBOARD
DEVICE_POINTER
MOTION_ABSOLUTE 🔒
PERSIST_UNTIL_REVOKED 🔒
REMOTE_DESKTOP_IFACE 🔒
REQUEST_IFACE 🔒
SCREENCAST_IFACE 🔒
SESSION_IFACE 🔒
SOURCE_MONITOR 🔒

Functions§

name_owned 🔒
Whether name has an owner on the bus conn is on.
next_message 🔒
The next message of stream, or None once it ends.
notify_loop 🔒
The input thread: each Notify* call once the one before it is answered, an absolute motion with another queued behind it left out; it ends with the session’s queue.
opt_u32 🔒
parse_streams 🔒
The a(ua{sv}) stream list of a Start response.
request_path 🔒
The request object the portal answers a call from sender with token on.
save_restore_token
Keep a restore token for the next session (a token is single-use, so the newest replaces the one that opened this session).
saved_restore_token
The restore token saved by an earlier session, if any.
sound_path 🔒
Whether path is absolute and free of ..: the XDG Base Directory specification has a relative path in its variables ignored.
token_path 🔒
Where the portal’s restore token lives between runs: $XDG_STATE_HOME/pixelflux, or ~/.local/state/pixelflux where that is unset or not absolute.
value_i32 🔒
value_pair 🔒

Type Aliases§

NotifyCall 🔒
A Notify* method for the input thread, and the call that makes it.
Options 🔒