Clipboard Portal
Wrapper around the org.freedesktop.portal.Clipboard D-Bus interface. Provides access to clipboard content for existing portal sessions.
This portal does not create its own session. It integrates with sessions from other portals, such as com.zugaldia.stargate.sdk.remotedesktop.RemoteDesktopPortal and the Input Capture portal. Call requestClipboard before the session starts to request clipboard access, then use setSelection, selectionWrite, selectionWriteDone, and selectionRead after the session is active.
Functions
Returns a Flow that emits whenever the clipboard selection changes. The emitted signal's Clipboard.SelectionOwnerChanged.getOptions map contains OPTION_MIME_TYPES (as) and RESULT_SESSION_IS_OWNER (b) keys.
Returns a Flow that emits whenever another client requests clipboard content from this session. Respond to each event by calling selectionWrite with the signal's serial, then selectionWriteDone when the transfer is complete. If the request is not handled, call selectionWriteDone with success = false.
Requests clipboard access for the given session. Must be called before the session starts. The session must be started before calling any other method in this interface. Note that other interfaces may place restrictions on when it is possible to interact with the clipboard.
Reads clipboard content for the given MIME type via a file descriptor. The creation of the file descriptor is the responsibility of the callee.
Responds to a observeSelectionTransfer event by providing clipboard content via a file descriptor. It is the callee that creates the file descriptor. Write the clipboard data to it, then call selectionWriteDone once the transfer completes or fails.
Notifies that a clipboard transfer initiated by selectionWrite has completed or failed. Must be called for every observeSelectionTransfer event, even on failure.
Sets the session as the owner of the clipboard for the given MIME types. The session will receive observeSelectionTransfer events when another client requests clipboard content in one of the advertised formats.