Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Rust wrapper around XDG portals DBus interfaces

License

NotificationsYou must be signed in to change notification settings

bilelmoussaoui/ashpd

Repository files navigation

docscrates.ioCI

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

Examples

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(())}

Optional features

FeatureDescriptionDefault
tracingRecord various debug information using thetracing libraryNo
tokioEnable tokio runtime on zbus dependencyYes
async-stdEnable the use of the async-std runtimeNo
backendunstable Enables APIs useful for writing portals implementationsNo
glibMake all the enums deriveglib::Enum. Flags are not supported yetNo
gtk4ImplementFrom<Color> forgdk4::RGBA ProvidesWindowIdentifier::from_native that takes aIsA<gtk4::Native>No
gtk4_waylandProvidesWindowIdentifier::from_native that takes aIsA<gtk4::Native> with Wayland backend support onlyNo
gtk4_x11ProvidesWindowIdentifier::from_native that takes aIsA<gtk4::Native> with X11 backend support onlyNo
pipewireProvidesashpd::desktop::camera::pipewire_streams that helps you retrieve the various camera streams associated with the retrieved file descriptorNo
raw_handleProvidesWindowIdentifier::from_raw_handle andWindowIdentifier::as_raw_handle forraw-window-handle crateNo
waylandProvidesWindowIdentifier::from_wayland forwayland-client crateNo
backendEnables portal backend implementation supoportNo

Demo

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.

Backend demo

The library also comes with abackend demo that exemplifies how to implementa portal backend.


[8]ページ先頭

©2009-2025 Movatter.jp