I cannot figure out how to add menu items to a Tauri 2.0.6 app. The following code compiles but there's no menu item showing up. It's completely blank on macOS.
src-tauri/src/main.rs
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use tauri::menu::*;
fn main() {
tauri::Builder::default()
.setup(|app| {
let toggle = MenuItemBuilder::with_id("toggle", "Toggle").build(app)?;
let check = CheckMenuItemBuilder::new("Mark").build(app)?;
let menu = MenuBuilder::new(app).items(&[&toggle, &check]).build()?;
app.set_menu(menu)?;
app.on_menu_event(move |app, event| {
if event.id() == check.id() {
println!(
"`check` triggered, do something! is checked? {}",
check.is_checked().unwrap()
);
} else if event.id() == "toggle" {
println!("toggle triggered!");
}
});
Ok(())
})
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_dialog::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
What step am I missing?
Reproduction
No response
Expected behavior
Next to the App icon, it should show the App Name, followed by the menu items.
Describe the bug
Hi,
I cannot figure out how to add menu items to a Tauri 2.0.6 app. The following code compiles but there's no menu item showing up. It's completely blank on macOS.
What step am I missing?
Reproduction
No response
Expected behavior
Next to the App icon, it should show the App Name, followed by the menu items.
Full
tauri info
outputStack trace
No response
Additional context
No response