pub struct PortalHelper { /* private fields */ }Expand description
XDG Desktop Portal ScreenCast helper (Linux only).
Opens a ScreenCast portal session to obtain a PipeWire stream, whose FD and
node ID can be handed to crate::controller::Controller::new_linux via
crate::common::LinuxControllerConfig’s pw_socket_fd / pw_node_id.
On non-Linux platforms, PortalHelper::new returns
MaaError::NullPointer because the underlying C API is unavailable there.
Implementations§
Source§impl PortalHelper
impl PortalHelper
Sourcepub fn open_stream(&self) -> MaaResult<()>
pub fn open_stream(&self) -> MaaResult<()>
Open the ScreenCast portal stream (create DBus session, select sources, and start the stream).
Sourcepub fn get_persist(&self) -> bool
pub fn get_persist(&self) -> bool
Whether the portal session is persistent (i.e. can be restored later).
Sourcepub fn set_persist(&self, enable: bool)
pub fn set_persist(&self, enable: bool)
Set whether the portal session should persist for later restoration.
Sourcepub fn get_pipewire_fd(&self) -> i32
pub fn get_pipewire_fd(&self) -> i32
The PipeWire socket FD, or -1 if the stream has not been opened yet.
Sourcepub fn get_pipewire_node_id(&self) -> u32
pub fn get_pipewire_node_id(&self) -> u32
The PipeWire node ID, or 0 if the stream has not been opened yet.
Sourcepub fn get_restore_token(&self) -> String
pub fn get_restore_token(&self) -> String
The restore token used to restore a persistent session.
Returns an empty string when no token is available.
Sourcepub fn set_restore_token(&self, token: &str) -> MaaResult<()>
pub fn set_restore_token(&self, token: &str) -> MaaResult<()>
Set the restore token to restore a previous portal session.