Module ashpd::desktop::screencast [−][src]
Expand description
Start a screencast session and get the PipeWire remote of it.
Examples
How to create a screen cast session & start it. The portal is currently useless without PipeWire & Rust support.
use ashpd::desktop::screencast::{CursorMode, ScreenCastProxy, SourceType}; use enumflags2::BitFlags; async fn run() -> Result<(), ashpd::Error> { let connection = zbus::azync::Connection::new_session().await?; let proxy = ScreenCastProxy::new(&connection).await?; let session = proxy.create_session().await?; proxy .select_sources( &session, BitFlags::from(CursorMode::Metadata), SourceType::Monitor | SourceType::Window, true, ) .await?; let streams = proxy.start(&session, Default::default()).await?; streams.iter().for_each(|stream| { println!("node id: {}", stream.pipe_wire_node_id()); println!("size: {:?}", stream.size()); println!("position: {:?}", stream.position()); }); Ok(()) }
Structs
ScreenCastProxy | The interface lets sandboxed applications create screen cast sessions. |
Stream | A PipeWire stream. |
Enums
CursorMode | A bit flag for the possible cursor modes. |
SourceType | A bit flag for the available sources to record. |