Replies: 1 comment
|
Your menu construction is valid. On Linux, Because this was posted while Tauri v2 was still in beta, I would first update and make sure the Rust You can also bypass the app-wide startup attachment and test the GTK window attachment directly: use tauri::{
menu::{Menu, MenuItem, Submenu},
Manager,
};
tauri::Builder::default()
.manage(state)
.setup(|app| {
let preferences = MenuItem::with_id(
app,
"preferences-item",
"Preferences",
true,
Some("CommandOrControl+,"),
)?;
let edit = Submenu::with_items(app, "Edit", true, &[&preferences])?;
let menu = Menu::with_items(app, &[&edit])?;
let window = app
.get_webview_window("main")
.expect("main window was not created");
window.set_menu(menu)?;
window.show_menu()?;
app.on_menu_event(|_, event| println!("{event:?}"));
Ok(())
})
.plugin(tauri_plugin_shell::init())
// ...If this works, the menu itself is fine and the problem was in the old beta/version combination or the startup attachment path. If it still does not appear, please include the output of The current menu guide and API still document |
Uh oh!
There was an error while loading. Please reload this page.
I use the following code to register a custom menu as well as to listen to events.
However, the window only shows my web content. There is no menu bar visible.
I am running Linux (Manjaro) and GNOME. If that matters.
All reactions