Module ashpd::desktop::device[][src]

Expand description

Request access to specific devices such as camera, speakers or microphone. Note this portal doesn’t work for sandboxed applications.

Examples

Access a Device

use ashpd::desktop::device::{Device, DeviceProxy};

async fn run() -> Result<(), ashpd::Error> {
    let connection = zbus::azync::Connection::new_session().await?;
    let proxy = DeviceProxy::new(&connection).await?;
    proxy.access_device(6879, &[Device::Speakers]).await?;
    Ok(())
}

Structs

DeviceProxy

The interface lets services ask if an application should get access to devices such as microphones, speakers or cameras. Not a portal in the strict sense, since the API is not directly accessible to applications inside the sandbox.

Enums

Device

The possible device to request access to.