Sitelet https://web.archive.org/web/20210206125939im_/https://github.com/bilelmoussaoui/ashpd
Skip to content
master
Go to file
Code

README.md

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

use ashpd::desktop::screenshot::{Color, PickColorOptions, ScreenshotProxy};
use ashpd::{RequestProxy, Response, WindowIdentifier};
use zbus::fdo::Result;

fn main() -> Result<()> {
    let connection = zbus::Connection::new_session()?;
    let proxy = ScreenshotProxy::new(&connection)?;
    
    let request_handle = proxy.pick_color(
            WindowIdentifier::default(),
            PickColorOptions::default()
    )?;
   
    let request = RequestProxy::new(&connection, &request_handle)?;
    request.on_response(|response: Response<Color>| {
        if let Ok(color) = response {
            println!("({}, {}, {})", color.red(), color.green(), color.blue());
        }
    })?;
   
    Ok(())
}

Optional features

Feature Description
feature_gtk3 Implement Into<gdk3::RGBA> for Color
Implement From<gtk3::Window> for WindowIdentifier
feature_gtk4 Implement Into<gdk4::RGBA> for Color
Implement From<gtk4::Window> for WindowIdentifier

Releases

No releases published

Packages

No packages published

Languages