tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] Setting the app menu in Tauri v2 on Mac OS

Open tdomhan opened this issue 4 months ago • 1 comments

Describe the bug

I'm trying to customize the application menu for a Tauri V2 app on Mac OS. While the default menu (that includes undo/repo and other items) works, I have not been able to successfully set a custom menu. I have been trying to follow the guide here: https://v2.tauri.app/start/migrate/from-tauri-1/#migrate-to-menu-module

Specifically:

tauri::Builder::default()
    .setup(|app| {
            let menu = MenuBuilder::new(app)
                .copy()
                .paste()
                .separator()
                .undo()
                .redo()
                .text("open-url", "Open URL")
                .check("toggle", "Toggle")
                .build()?;
            app.set_menu(menu)?;
            Ok(())
    })
    .run(tauri::generate_context!())
    .expect("error while running tauri application");

Version info: Tauri: 2.0.4 muda v0.15.1 MacOS: 15.0.1

When I don't set the menu I see the default menu. When I set it my menu bar is empty (see screenshot).

Screenshot 2024-10-19 at 11 10 21

Reproduction

No response

Expected behavior

No response

Full tauri info output

WARNING: no lock files found, defaulting to npm

[✔] Environment
    - OS: Mac OS 15.0.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.83.0-nightly (9ff5fc4ff 2024-10-03)
    ✔ cargo: 1.83.0-nightly (80d82ca22 2024-09-27)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: nightly-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.10.0
    - yarn: 1.22.19
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.4
    - tauri-build [RUST]: 2.0.1
    - wry [RUST]: 0.46.2
    - tao [RUST]: 0.30.3
    - tauri-cli [RUST]: 2.0.0-beta.20
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20 (outdated, latest: 2.0.3)

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/

Stack trace

No response

Additional context

No response

tdomhan avatar Oct 20 '24 04:10 tdomhan