Update Tauri from v1 to v2 (#496)
* Upgrade tauri to v2 * update action and disable menu * Add args to workflow step in test.yml * Rename environment variables for Tauri signing * Change mainBinaryName from 'Cinny' to 'cinny' * Update linux file names to use 'Cinny' instead of 'cinny' * Upgrade Tauri action to v0.6.1 and fix targets Updated Tauri action version and corrected target specification.
This commit is contained in:
@@ -1,41 +1,44 @@
|
||||
use tauri::{AboutMetadata, Menu, MenuItem, Submenu};
|
||||
//for macOS
|
||||
pub(crate) fn menu() -> Menu {
|
||||
Menu::new()
|
||||
.add_submenu(Submenu::new(
|
||||
"Cinny",
|
||||
Menu::new()
|
||||
.add_native_item(MenuItem::About(
|
||||
"Cinny".to_string(),
|
||||
AboutMetadata::new(),
|
||||
))
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_native_item(MenuItem::Hide)
|
||||
.add_native_item(MenuItem::HideOthers)
|
||||
.add_native_item(MenuItem::ShowAll)
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_native_item(MenuItem::Quit),
|
||||
))
|
||||
.add_submenu(Submenu::new(
|
||||
"Edit",
|
||||
Menu::new()
|
||||
.add_native_item(MenuItem::Undo)
|
||||
.add_native_item(MenuItem::Redo)
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_native_item(MenuItem::Cut)
|
||||
.add_native_item(MenuItem::Copy)
|
||||
.add_native_item(MenuItem::Paste)
|
||||
.add_native_item(MenuItem::SelectAll),
|
||||
))
|
||||
.add_submenu(Submenu::new(
|
||||
"View",
|
||||
Menu::new()
|
||||
.add_native_item(MenuItem::EnterFullScreen),
|
||||
))
|
||||
.add_submenu(Submenu::new(
|
||||
"Window",
|
||||
Menu::new()
|
||||
.add_native_item(MenuItem::Minimize)
|
||||
.add_native_item(MenuItem::Zoom),
|
||||
))
|
||||
}
|
||||
use tauri::menu::{MenuBuilder, SubmenuBuilder};
|
||||
use tauri::AppHandle;
|
||||
|
||||
pub fn menu() -> tauri::menu::Menu {
|
||||
let app_menu = SubmenuBuilder::new(app, "Cinny")
|
||||
.about(Some(Default::default()))
|
||||
.separator()
|
||||
.hide()
|
||||
.hide_others()
|
||||
.show_all()
|
||||
.separator()
|
||||
.quit()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let edit_menu = SubmenuBuilder::new(app, "Edit")
|
||||
.undo()
|
||||
.redo()
|
||||
.separator()
|
||||
.cut()
|
||||
.copy()
|
||||
.paste()
|
||||
.select_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let view_menu = SubmenuBuilder::new(app, "View")
|
||||
.fullscreen() // `.fullscreen()` works instead of `.enter_fullscreen()`
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let window_menu = SubmenuBuilder::new(app, "Window")
|
||||
.minimize()
|
||||
.build() // no `.zoom()` method directly available
|
||||
.unwrap();
|
||||
|
||||
MenuBuilder::new(app)
|
||||
.item(&app_menu)
|
||||
.item(&edit_menu)
|
||||
.item(&view_menu)
|
||||
.item(&window_menu)
|
||||
.build()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user