logo
Expand description

Interact with the documents store or transfer files across apps.

Examples

use ashpd::documents::{DocumentsProxy, Permission};

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

    println!("{:#?}", proxy.mount_point().await?);

    for (doc_id, host_path) in proxy.list("org.mozilla.firefox").await? {
        if doc_id == "f2ee988d" {
            let info = proxy.info(&doc_id).await?;
            println!("{:#?}", info);
        }
    }

    proxy
        .grant_permissions(
            "f2ee988d",
            "org.mozilla.firefox",
            &[Permission::GrantPermissions],
        )
        .await?;
    proxy
        .revoke_permissions("f2ee988d", "org.mozilla.firefox", &[Permission::Write])
        .await?;

    proxy.delete("f2ee988d").await?;

    Ok(())
}

Structs

The interface lets sandboxed applications make files from the outside world available to sandboxed applications in a controlled way.

The interface operates as a middle-man between apps when transferring files via drag-and-drop or copy-paste, taking care of the necessary exporting of files in the document portal.

Enums

The possible permissions to grant to a specific application for a specific document.

Type Definitions

A HashMap mapping application IDs to the permissions for that application