Code Monkey home page Code Monkey logo

ashpd's Introduction

ASHPD

docs crates.io CI

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().await?;
        let remote_fd = camera.open_pipe_wire_remote().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 No
async-std Enable the use of the async-std runtime Yes
gtk4 Implement From<Color> for gdk4::RGBA Provides WindowIdentifier::from_native that takes a IsA<gtk4::Native> No
gtk4_wayland Provides WindowIdentifier::from_native that takes a IsA<gtk4::Native> with Wayland backend support only No
gtk4_x11 Provides WindowIdentifier::from_native that takes a IsA<gtk4::Native> 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

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.

ashpd's People

Contributors

bilelmoussaoui avatar a6gibkm avatar carlosmn avatar ids1024 avatar cogitri avatar sophie-h avatar msizanoen1 avatar hofer-julian avatar d2weber avatar seadve avatar polymeilex avatar whot avatar alatiera avatar jneem avatar dependabot[bot] avatar baarkerlounger avatar zeenix avatar ryuukyu313 avatar bertob avatar t0b1-ios avatar olivierlemasle avatar newbytee avatar jtojnar avatar jimmac avatar finefindus avatar feschber avatar brainblasted avatar be-ing avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.