more-wallpapers 0.1.0

crossplatform library to set desktop wallpaper per screen
Documentation

more-wallpapers License: MIT OR Apache-2.0 more-wallpapers on crates.io more-wallpapers on docs.rs Source Code Repository more-wallpapers on deps.rs

Yet another wallpaper crate, which can set a wallpapers per screen.

The main feature over other crates like wallpaper or wall is the ability to set different wallpapers on different screens. Currently this feature is only implemented for some enviroments. Because of this you can enable the “wallpaper” feature, which uses the wallpaper crate as a fallback on unsupported environments. This means you can use the additonal features of this crate and still support the large amount of supported enviroments of the wallpaper crate.

Currently the following enviroments are supported:

enviroment set wallpaper set wallpaper per screen requirements
Windows features=["wallpaper"]
MacOS features=["wallpaper"]
X11 xwallpaper
Budgie(wayland) features=["wallpaper"]
Deepin(wayland) features=["wallpaper"]
GNOME(wayland) features=["wallpaper"]
KDE xrandr, dbus
Mate(wayland) features=["wallpaper"]
Sway features=["wallpaper"], swaybg
some other wayland desktops features=["wallpaper"], swaybg, dektop must support wlr-layer-shell protocol and wl_output version 4

The information about the currently supported features are also provided by Enviroment.

QuickStart / Examples: If you would like to set only a different wallpaper for each screen and don’t care which wallpaper is used on which screen, you can use set_wallpapers_from_vec() or set_random_wallpapers_from_vec():

use more_wallpapers::Mode;

let images = vec!["/usr/share/wallpapers/1.jpg", "/usr/share/wallpapers/2.jpg"];
more_wallpapers::set_wallpapers_from_vec(images, Mode::Crop)?;

For advanced wallpaper settings you can use the WallpaperBuilder:

use more_wallpapers::{Mode, WallpaperBuilder};

let fallback_images = vec!["/usr/share/wallpapers/1.jpg", "/usr/share/wallpapers/2.jpg"];
WallpaperBuilder::new()?.set_wallapers(|i, screen| -> (String, Mode) {
	if i == 0 {
		return (
			"/usr/share/wallpapers/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,
	)
})?;