#desktop #wallpaper #background

more-wallpapers

crossplatform library to set desktop wallpaper per screen

5 unstable releases

0.3.0 Jan 4, 2023
0.2.1 Dec 8, 2022
0.2.0 Dec 7, 2022
0.1.1 Jul 5, 2022
0.1.0 Jul 5, 2022

#3 in #background

Download history 11/week @ 2022-10-08 12/week @ 2022-10-15 6/week @ 2022-10-22 9/week @ 2022-10-29 7/week @ 2022-11-05 4/week @ 2022-11-12 7/week @ 2022-11-19 2/week @ 2022-11-26 51/week @ 2022-12-03 13/week @ 2022-12-10 6/week @ 2022-12-17 6/week @ 2022-12-24 25/week @ 2022-12-31 9/week @ 2023-01-07 9/week @ 2023-01-14 17/week @ 2023-01-21

61 downloads per month
Used in konachan-wallpaper

MIT/Apache

33KB
687 lines

more-wallpapers License: MIT OR Apache-2.0 more-wallpapers on crates.io more-wallpapers on docs.rs Source Code Repository Rust Version: ^1.62

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 environments. Because of this you can enable the fallback feature, to use a custom version of the wallpaper crate as a fallback on unsupported environments. This means you can use the additonal features of this crate and still support a large amount of environments.

Currently the following environments are supported:

environment set wallpaper set wallpaper per screen requirements
Windows features=["fallback"]¹
MacOS features=["fallback"]¹
X11³ xwallpaper, libxrandr²
Budgie(wayland) features=["fallback"]¹
Cinnamon⁴ xwallpaper, libxrandr²
Deepin(wayland) features=["fallback"]¹
GNOME(wayland) features=["fallback"]¹
KDE
Mate(wayland) features=["fallback"]¹
Sway features=["fallback"]¹

¹ Please check also the requirements of the wallpaper crate.
² Normally already installed.
³ Wallpapers will be reset after restart.
⁴ Wallpapers will be reset to provided default after restart.

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

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() (only aviable with the rand feature):

use more_wallpapers::Mode;

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

The "default.jpg" is used as wallpaper for inactive screens. If you do not know witch value you shoud use here, you can simple use the first elment of the images vec.

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"];
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,
	)
})?;

Dependencies

~0.3–1.5MB
~31K SLoC