Module ashpd::desktop::open_uri [−][src]
Expand description
Open a file or a directory.
Examples
Open a file
use ashpd::desktop::open_uri::OpenURIProxy; use std::fs::File; use std::os::unix::io::AsRawFd; use zvariant::Fd; async fn run() -> Result<(), ashpd::Error> { let file = File::open("/home/bilelmoussaoui/Downloads/adwaita-night.jpg").unwrap(); let connection = zbus::azync::Connection::new_session().await?; let proxy = OpenURIProxy::new(&connection).await?; proxy .open_file(Default::default(), Fd::from(file.as_raw_fd()), false, true) .await?; Ok(()) }
Open a file from a URI
use ashpd::desktop::open_uri::OpenURIProxy; async fn run() -> Result<(), ashpd::Error> { let connection = zbus::azync::Connection::new_session().await?; let proxy = OpenURIProxy::new(&connection).await?; proxy .open_uri( Default::default(), "file:///home/bilelmoussaoui/Downloads/adwaita-night.jpg", false, true, ) .await?; Ok(()) }
Structs
OpenURIProxy | The interface lets sandboxed applications open URIs (e.g. a http: link to the applications homepage) under the control of the user. |