#screen #dbus #capture #linux #screen-capture #ffi

portal-screencast

Rustic interface to the ScreenCast Desktop Portal

1 unstable release

0.1.0 Mar 5, 2021

#873 in GUI

27 downloads per month

MIT license

18KB
355 lines

Rust API to the ScreenCast Desktop Portal

Access to system resources on Linux can be negotitated in some environments through calls to D-Bus 'portal' APIs. One such portal is the ScreenCast portal. This portal allows a user to choose which windows or screens to share and provides access to raw video data through PipeWire.

Simple Use

In the simples case this crate can be used to open a new screen cast with the default settings:

let screen_cast = ScreenCast::new()?.Start()?;

Structure

There are three main objects to interact with: ScreenCast, ActiveScreenCast, and ScreenCastStream. The ScreenCast type is used to configure what type of screen cast to prompt the user for. It is tramsformed into an ActiveScreenCast by calling start(). Once active interaction with the cast takes place over a Pipewire session using the pipewire_fd() and streams().

Under the hood this is be backed by some private structs: ConnectionState to manage our D-Bus connection; Request, and Session to handle interacting with request and session proxies.

Dependencies

~5.5MB
~122K SLoC