百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

ashpd

> 编程语言
开源

一个围绕 XDG 门户 DBus 接口的 Rust 封装

366 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个围绕 XDG 门户 DBus 接口的 Rust 封装

ASHPD

ASHPD, acronym of Aperture Science Handheld Portal Device is a Rust & zbus wrapper of the XDG portals DBus interfaces. The library aims to provide an easy way to interact with the various portals defined per the specifications. It provides an alternative to the C library https://github.com/flatpak/libportal

Examples

Ask the compositor to pick a color

use ashpd::desktop::Color;

async fn run() -> 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;

pub async fn run() -> ashpd::Result {
    let camera = Camera::new().await?;
    if camera.is_present().await? {
        camera.request_access(Default::default()).await?;
        let remote_fd = camera.open_pipe_wire_remote(Default::default()).await?;
        // pass the remote fd to GStreamer for example
    }
    Ok(())
}

Optional features

Feature Description Default
tracing Record various debug information using the tracing library No
tokio Enable tokio runtime on zbus dependency Yes
async-io Enable the use of the async-io crates, compatible with runtimes such smol or glib No
frontend Enables all frontend APIs, individual APIs can be enabled separately if needed with account , camera, screencast and so on No
glib Make all the enums derive glib::Enum. Flags are not supported yet No
gtk4 Implement From for gdk4::RGBA Provides WindowIdentifier::from_native that takes a IsA No
gtk4_wayland Provides WindowIdentifier::from_native that takes a IsA with Wayland backend support only No
gtk4_x11 Provides WindowIdentifier::from_native that takes a IsA with X11 backend support only No
pipewire Provides ashpd::desktop::camera::pipewire_streams that helps you retrieve the various camera streams associated with the retrieved file descriptor No
raw_handle Provides WindowIdentifier::from_raw_handle and WindowIdentifier::as_raw_handle for raw-window-handle crate No
wayland Provides WindowIdentifier::from_wayland for wayland-client crate No
backend Enables portal backend implementation support No

Demo

The library comes with a demo built using the GTK 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.

Translations

Helping to translate ASHPD Demo or add support to a new language is very welcome. You can find everything you need at: l10n.gnome.org/module/ashpd/

Backend demo

The library also comes with a backend demo that exemplifies how to implement a portal backend.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustflatpaklibportalportalsrust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言