Windows build support: conditional macOS app menu, devtools feature
- Gate OpenPencil app submenu (About/Services/Hide/Quit) behind #[cfg(target_os = "macos")] — Windows/Linux don't have it - Enable tauri "devtools" feature in Cargo.toml (required for open_devtools/close_devtools on non-macOS)
This commit is contained in:
parent
ab9b4ac37c
commit
2ab99ac4fe
|
|
@ -18,7 +18,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
|||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri = { version = "2", features = ["devtools"] }
|
||||
tauri-plugin-opener = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ pub fn run() {
|
|||
let _ = app.emit("menu-event", event.id().0.as_str());
|
||||
})
|
||||
.setup(|app| {
|
||||
#[cfg(target_os = "macos")]
|
||||
let app_menu = SubmenuBuilder::new(app, "OpenPencil")
|
||||
.item(&PredefinedMenuItem::about(app, Some("About OpenPencil"), None)?)
|
||||
.separator()
|
||||
|
|
@ -223,9 +224,13 @@ pub fn run() {
|
|||
)
|
||||
.build()?;
|
||||
|
||||
let menu = MenuBuilder::new(app)
|
||||
let mut builder = MenuBuilder::new(app);
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
builder = builder.item(&app_menu);
|
||||
}
|
||||
let menu = builder
|
||||
.items(&[
|
||||
&app_menu,
|
||||
&file_menu,
|
||||
&edit_menu,
|
||||
&view_menu,
|
||||
|
|
|
|||
Loading…
Reference in a new issue