ahkohd / tauri-macos-spotlight-example

An example macOS Spotlight app built with Tauri
MIT License
148 stars 9 forks source link

[SOLVED] App panicks when using more than one window #7

Closed gaandurian closed 1 year ago

gaandurian commented 1 year ago

Make sure to call init_spotlight_window in the correct window on the frontend

I was making this mistake where I was calling init_spotlight in a different window than the actual target window and then trying to hide the panel using the ESC key, which then invokes hide_window and the app kept crashing.

Here's a error message for anyone googling it.

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/spotlight.rs:149:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Also make sure to set the correct panel label on line 113 of spotlight.rs

static PANEL_LABEL: &str = "main"; // Defaults to main