[go: up one dir, main page]

logo
Expand description

Query the user’s GPS location.

Examples

use ashpd::desktop::location::{Accuracy, LocationProxy};
use ashpd::WindowIdentifier;
use futures::TryFutureExt;

async fn run() -> ashpd::Result<()> {
    let connection = zbus::Connection::session().await?;
    let proxy = LocationProxy::new(&connection).await?;
    let identifier = WindowIdentifier::default();

    let session = proxy.create_session(None, None, Some(Accuracy::Street)).await?;

    let (_, location) = futures::try_join!(
        proxy.start(&session, &identifier).into_future(),
        proxy.receive_location_updated().into_future()
    )?;

    println!("{}", location.accuracy());
    println!("{}", location.longitude());
    println!("{}", location.latitude());
    session.close().await?;

    Ok(())
}

Structs

The response received on a location_updated signal.

The interface lets sandboxed applications query basic information about the location.

Enums

The accuracy of the location.