logo
Expand description

Request access to the current logged user information such as the id, name or their avatar uri.

Examples

use ashpd::desktop::account;
use ashpd::WindowIdentifier;

async fn run() -> ashpd::Result<()> {
    let user_info = account::user_information(
        &WindowIdentifier::default(),
        "App would like to access user information",
    ).await?;

    println!("Name: {}", user_info.name());
    println!("ID: {}", user_info.id());

    Ok(())
}

Or by using the Proxy directly

use ashpd::desktop::account::AccountProxy;
use ashpd::WindowIdentifier;

async fn run() -> ashpd::Result<()> {
    let connection = zbus::Connection::session().await?;

    let proxy = AccountProxy::new(&connection).await?;
    let user_info = proxy
        .user_information(
            &WindowIdentifier::default(),
            "App would like to access user information",
        )
        .await?;

    println!("Name: {}", user_info.name());
    println!("ID: {}", user_info.id());

    Ok(())
}

Structs

The interface lets sandboxed applications query basic information about the user, like his name and avatar photo.

The response of a AccountProxy::user_information request.

Functions