Expand description
Set a wallpaper on lockscreen, background or both.
Wrapper of the DBus interface: org.freedesktop.portal.Wallpaper
.
§Examples
§Sets a wallpaper from a file:
use std::{fs::File, os::fd::AsFd};
use ashpd::desktop::wallpaper::{SetOn, WallpaperRequest};
async fn run() -> ashpd::Result<()> {
let file = File::open("/home/bilelmoussaoui/adwaita-day.jpg").unwrap();
WallpaperRequest::default()
.set_on(SetOn::Both)
.show_preview(true)
.build_file(&file.as_fd())
.await?;
Ok(())
}
§Sets a wallpaper from a URI:
use ashpd::desktop::wallpaper::{SetOn, WallpaperRequest};
async fn run() -> ashpd::Result<()> {
let uri =
url::Url::parse("file:///home/bilelmoussaoui/Downloads/adwaita-night.jpg").unwrap();
WallpaperRequest::default()
.set_on(SetOn::Both)
.show_preview(true)
.build_uri(&uri)
.await?;
Ok(())
}
Structs§
- A builder-pattern type to set the wallpaper.
Enums§
- Where to set the wallpaper on.