tauri-apps / window-vibrancy

Make your windows vibrant.
Apache License 2.0
624 stars 32 forks source link

Failed to unregister class Chrome_WidgetWin_0. Error = 0 #61

Closed justintaylor-dev closed 2 years ago

justintaylor-dev commented 2 years ago

Trying this plugin with a fresh Tauri Svelte-TS project. Saw in the issues that we should use 0.1.3 until Tauri 1.1 comes out, but still having this issue:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src\main.rs:17:48
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[0912/170933.687:ERROR:window_impl.cc(114)] Failed to unregister class Chrome_WidgetWin_0. Error = 0
error Command failed with exit code 4294967295.

Full main.rs

#![cfg_attr(
    all(not(debug_assertions), target_os = "windows"),
    windows_subsystem = "windows"
)]

#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}! You've been greeted from Rust!", name)
}

use tauri::Manager;
use window_vibrancy::{apply_blur, apply_vibrancy, NSVisualEffectMaterial};

fn main() {
    tauri::Builder::default()
        .setup(|app| {
            let window = app.get_window("app").unwrap();

            #[cfg(target_os = "macos")]
            apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow)
                .expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");

            #[cfg(target_os = "windows")]
            apply_blur(&window, Some((18, 18, 18, 125)))
                .expect("Unsupported platform! 'apply_blur' is only supported on Windows");
            Ok(())
        })
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Full TOML:

[package]
name = "tauri-svelte"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"
rust-version = "1.57"

[build-dependencies]
tauri-build = { version = "1.0.0", features = [] }

[dependencies]
serde_json = "1.0"
window-vibrancy = { version = "0.1.3" }
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.0.0", features = ["api-all", "macos-private-api"] }

[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

Thanks!

lucasfernog commented 2 years ago

let window = app.get_window("app").unwrap(); that should be let window = app.get_window("main").unwrap();