#How to show window from systemTray?

7 messages · Page 1 of 1 (latest)

vivid heart
#

Hello, I'm trying to show the window when clicked on "Show" on the systemTray.
I'm using this boilerplate that makes the Tauri app behave like macOS spotlight
https://github.com/ahkohd/tauri-macos-spotlight-example

I'm trying to call the show_spotlight function from the "show" block in SystemTrayEvent::MenuItemClick

There are two main Rust files: main.rs and spotlight.rs

main.rs (https://gist.github.com/T31K/2e0c693d4011d5c08cc1ca3e5065aff6)
spotlight.rs (https://github.com/ahkohd/tauri-macos-spotlight-example/blob/main/src-tauri/src/spotlight.rs)

timber dirge
#
app.get_window("main")
#
window.show()
#

also why do you have 2 match statements?

#
.on_system_tray_event(|handle, event| {
    let tauri::SystemTrayEvent::MenuItemClick { id, .. } = event else {
        return;
    };

    let Some(window) = handle.get_window("main") else {
        return;
    };

    match id.as_str() {
        "show" => {
            window.show();
        }
        "quit" => {
            window.hide();
        }
        _ => {}
    };
})
vivid heart
#

oh ya forgot abou tthat

#

thanks!