wallpaper-ng

Crates.iowallpaper-ng
lib.rswallpaper-ng
version0.1.1
created_at2025-12-09 23:16:24.876204+00
updated_at2026-01-18 22:57:42.310621+00
descriptionGets and sets the desktop wallpaper/background.
homepage
repositoryhttps://github.com/davidpob99/wallpaper-ng
max_upload_size
id1977002
size77,707
David Población Criado (davidpob99)

documentation

README

wallpaper

This Rust library gets and sets the desktop wallpaper/background.

The supported desktops are:

  • Windows
  • macOS
  • GNOME
  • KDE
  • Cinnamon
  • Unity
  • Budgie
  • XFCE
  • LXDE
  • MATE
  • Deepin
  • Most Wayland compositors (set only, requires swaybg)
  • i3 (set only, requires feh)

Credits

This project is a maintained fork of the wallpaper crate. We would like to acknowledge the work of the original authors, who dedicated their code to the public domain via The Unlicense.

Examples

use wallpaper;

fn main() {
    // Returns the wallpaper of the current desktop.
    println!("{:?}", wallpaper::get());
    // Sets the wallpaper for the current desktop from a file path.
    wallpaper::set_from_path("/usr/share/backgrounds/gnome/adwaita-day.png").unwrap();
    // Sets the wallpaper style.
    wallpaper::set_mode(wallpaper::Mode::Crop).unwrap();
    // Returns the wallpaper of the current desktop.
    println!("{:?}", wallpaper::get());
}

If you want to set an image as background via an URL, make sure you activated the from_url feature of the wallpaper crate on Cargo.toml:

[dependencies]
wallpaper = { version = "3", features = ["from_url"] }

Then, on your main.rs:

use wallpaper;

fn main() {
    // Returns the wallpaper of the current desktop.
    println!("{:?}", wallpaper::get());
    // Sets the wallpaper for the current desktop from a URL.
    wallpaper::set_from_url("https://source.unsplash.com/random").unwrap();
    // Returns the wallpaper of the current desktop.
    println!("{:?}", wallpaper::get());
}
Commit count: 92

cargo fmt