tauri-plugin-wallpaper

Crates.iotauri-plugin-wallpaper
lib.rstauri-plugin-wallpaper
version2.0.0-beta
sourcesrc
created_at2023-03-29 20:27:25.37307
updated_at2024-10-24 07:09:31.921867
descriptionA Tauri plugin to set your window as wallpaper behind desktop icons
homepagehttps://github.com/meslzy/tauri-plugin-wallpaper
repositoryhttps://github.com/meslzy/tauri-plugin-wallpaper
max_upload_size
id824372
size23,615
Meslzy (meslzy)

documentation

https://docs.rs/tauri-plugin-wallpaper

README

Tauri Plugin Wallpaper (✨)

A Tauri plugin to set your window as wallpaper behind desktop icons


license issues stars


Available platforms (🚧)

  • Windows
  • MacOS
  • Linux

Getting Started (✅)

  • Installation (⏬)

    • cargo

      cargo add tauri-plugin-wallpaper
      
    • npm

      npm install tauri-plugin-wallpaper
      

How to use (🌠)

  • cargo
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![show, hide])
        .plugin(tauri_plugin_wallpaper::init())
        .setup(|app| {
            let app_handle = app.handle();
            let webview_window = app_handle.get_webview_window("wallpaper").unwrap();
            // attach window to wallpaper
            app_handle
                .wallpaper()
                .attach_window(&webview_window)
                .unwrap();
            // attach using window label identifier
            app_handle
                .wallpaper()
                .attach(AttachRequest::new("window_label"))
                .unwrap();

            // detach window from wallpaper
            app_handle
                .wallpaper()
                .detach_window(&webview_window)
                .unwrap();

            // detach using window label identifier
            app_handle
                .wallpaper()
                .detach(DetachRequest::new("window_label"))
                .unwrap();

            // reset wallpaper
            app_handle.wallpaper().reset().unwrap();
            Ok(())
        })
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
  • npm
import wallpaper from "tauri-plugin-wallpaper";
// or import { attach, detach, reset } from "tauri-plugin-wallpaper";

// Attach current window as wallpaper
wallpaper.attach();
// or using window label identifier
wallpaper.attach("window-label");

// detach current window from wallpaper
wallpaper.detach();
// or using window label identifier
wallpaper.detach("window-label");

// reset wallpaper
wallpaper.reset();

The End (💘)

Commit count: 1

cargo fmt