pub struct WallpaperBuilder { /* private fields */ }
Expand description

Builder for advance Wallpaper settings and informations. This struct should not be stored for a long time, because it can become outdated if the user connect or disconnect monitors or change the Display settings.

Implementations§

Return the count of active screens. This does not include disable screens.

Return the count of active screens. This does not include disable screens.

Return the current desktop environment.

Return a vec including all detected Screens

Set background to wallpapers, witch will be selected by the given closure. The index oft screen and the current screen are passed to the closure.x

use more_wallpapers::{Mode, WallpaperBuilder};

let fallback_images = vec!["/usr/share/wallpapers/1.jpg", "/usr/share/wallpapers/2.jpg"];
let mut i = 0;
WallpaperBuilder::new()?.set_wallpapers(|screen| {
	i += 1;
	if i == 1 {
		return ("first.jpg".to_owned(), Mode::default());
	}
	if screen.name == "HDMI1" {
		return ("/usr/share/wallpapers/hdmi.jpg".to_owned(), Mode::Fit);
	}
	(
		fallback_images[i % fallback_images.len()].to_owned(),
		Mode::Tile,
	)
})?;

Set the background of all screens to the wallpapers of wallpapers. The wallpaper of screen[i] will be set to wallpapers[i mod wallpapers.len()]. The default_wallpaper param is used if the given wallpapers vec is empty and as wallpaper for inactive screens. Return a vec, with dose inlcude the path of the Wallpapers, witch was set as background. If the same wallpaper was set multiple times to different screens, the return value does also include the wallpaper multiple times.

use more_wallpapers::{WallpaperBuilder, Mode};

let images = vec!["1.jpg", "/usr/share/wallpapers/2.jpg"];
let used_wallpapers = WallpaperBuilder::new()?.set_wallpapers_from_vec(images, "default.png", Mode::Crop)?;
println!("background was set to the following wallpapers {used_wallpapers:?}");
Available on crate feature rand only.

Like Self::set_wallpapers_from_vec, but map the wallpapers randomly to the screens. Selecting the same wallpaper multiple time will be avoid, if this is possible.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.