mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 00:13:44 +08:00
feat: add macOS application menu integration
This commit is contained in:
parent
a2ff0a7e20
commit
baa535b609
@ -11,9 +11,12 @@ use crate::{
|
||||
};
|
||||
use config::Config;
|
||||
use std::sync::{Mutex, Once};
|
||||
use tauri::AppHandle;
|
||||
#[cfg(target_os = "macos")]
|
||||
use tauri::Manager;
|
||||
use tauri::{
|
||||
menu::{Menu, MenuItem, Submenu},
|
||||
AppHandle,
|
||||
};
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
use tauri_plugin_deep_link::DeepLinkExt;
|
||||
|
||||
@ -99,7 +102,6 @@ pub fn run() {
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
let devtools = tauri_plugin_devtools::init();
|
||||
|
||||
#[allow(unused_mut)]
|
||||
let mut builder = tauri::Builder::default()
|
||||
.plugin(tauri_plugin_autostart::init(
|
||||
@ -220,6 +222,23 @@ pub fn run() {
|
||||
builder = builder.plugin(devtools);
|
||||
}
|
||||
|
||||
// Macos Application Menu
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
builder = builder.menu(|handle| {
|
||||
Menu::with_items(
|
||||
handle,
|
||||
&[&Submenu::with_items(
|
||||
handle,
|
||||
"Menu",
|
||||
true,
|
||||
&[&MenuItem::new(handle, "Clash Verge", true, None::<String>).unwrap()],
|
||||
)
|
||||
.unwrap()],
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
let app = builder
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
Loading…
x
Reference in New Issue
Block a user