- Notifications
You must be signed in to change notification settings - Fork50
A Rust wrapper around XDG portals DBus interfaces
License
bilelmoussaoui/ashpd
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ASHPD, acronym of Aperture Science Handheld Portal Device is a Rust &zbus wrapper ofthe XDG portals DBus interfaces. The library aims to provide an easy way tointeract with the various portals defined per thespecifications.It provides an alternative to the C libraryhttps://github.com/flatpak/libportal
Ask the compositor to pick a color
use ashpd::desktop::Color;asyncfnrun() -> ashpd::Result<()>{let color =Color::pick().send().await?.response()?;println!("({}, {}, {})", color.red(), color.green(), color.blue());Ok(())}
Start a PipeWire stream from the user's camera
use ashpd::desktop::camera::Camera;pubasyncfnrun() -> ashpd::Result<()>{let camera =Camera::new().await?;if camera.is_present().await?{ camera.request_access().await?;let remote_fd = camera.open_pipe_wire_remote().await?;// pass the remote fd to GStreamer for example}Ok(())}
Feature | Description | Default |
---|---|---|
tracing | Record various debug information using thetracing library | No |
tokio | Enable tokio runtime on zbus dependency | Yes |
async-std | Enable the use of the async-std runtime | No |
backend | unstable Enables APIs useful for writing portals implementations | No |
glib | Make all the enums deriveglib::Enum . Flags are not supported yet | No |
gtk4 | ImplementFrom<Color> forgdk4::RGBA ProvidesWindowIdentifier::from_native that takes aIsA<gtk4::Native> | No |
gtk4_wayland | ProvidesWindowIdentifier::from_native that takes aIsA<gtk4::Native> with Wayland backend support only | No |
gtk4_x11 | ProvidesWindowIdentifier::from_native that takes aIsA<gtk4::Native> with X11 backend support only | No |
pipewire | Providesashpd::desktop::camera::pipewire_streams that helps you retrieve the various camera streams associated with the retrieved file descriptor | No |
raw_handle | ProvidesWindowIdentifier::from_raw_handle andWindowIdentifier::as_raw_handle forraw-window-handle crate | No |
wayland | ProvidesWindowIdentifier::from_wayland forwayland-client crate | No |
backend | Enables portal backend implementation supoport | No |
The library comes with ademo built using theGTK 4 Rust bindings and previews most of the portals. It is meant as a test case for the portals (from a distributor perspective) and as a way for the developers to see which portals exists and how to integrate them into their application using ASHPD.
The library also comes with abackend demo that exemplifies how to implementa portal backend.
About
A Rust wrapper around XDG portals DBus interfaces