Thanks to visit codestin.com
Credit goes to lib.rs

#screen-capture #dbus #linux #ffi

portal-screencast-waycap

Rustic interface to the ScreenCast Desktop Portal

3 releases (stable)

1.1.0 May 8, 2026
1.0.0 May 26, 2025
0.1.1 May 26, 2025

#59 in #screen-capture


Used in waycap-rs

MIT license

24KB
431 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.

This is a fork of the one found in https://github.com/iwillspeak/obs-screencap which adds the ability to set cursor visibility and additonal stream metadata.

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

~4–6MB
~122K SLoC