Available on crate feature
open_uri only.Expand description
Open a URI or a directory.
Wrapper of the DBus interface: org.freedesktop.portal.OpenURI.
§Examples
§Open a file
use std::{fs::File, os::fd::AsFd};
use ashpd::desktop::open_uri::OpenFileRequest;
async fn run() -> ashpd::Result<()> {
let file = File::open("/home/bilelmoussaoui/adwaita-day.jpg").unwrap();
OpenFileRequest::default()
.ask(true)
.send_file(&file.as_fd())
.await?;
Ok(())
}§Open a file from a URI
use ashpd::desktop::open_uri::OpenFileRequest;
async fn run() -> ashpd::Result<()> {
let uri =
ashpd::Uri::parse("file:///home/bilelmoussaoui/Downloads/adwaita-night.jpg").unwrap();
OpenFileRequest::default().ask(true).send_uri(&uri).await?;
Ok(())
}§Open a directory
use std::{fs::File, os::fd::AsFd};
use ashpd::desktop::open_uri::OpenDirectoryRequest;
async fn run() -> ashpd::Result<()> {
let directory = File::open("/home/bilelmoussaoui/Downloads").unwrap();
OpenDirectoryRequest::default()
.send(&directory.as_fd())
.await?;
Ok(())
}Structs§
- Open
DirOptions - Options passed to
OpenURIProxy::open_directory. - Open
Directory Request - A builder-pattern type to open a directory.
- Open
File Options - Options passed to
OpenURIProxy::open_file. - Open
File Request - A builder-pattern type to open a file.
- OpenURI
Proxy - The interface lets sandboxed applications open URIs (e.g. a http: link to the applications homepage) under the control of the user.
- Scheme
Supported Options - Options passed to
OpenURIProxy::scheme_supported.