mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
chore: update
This commit is contained in:
@@ -11,7 +11,7 @@ mod feat;
|
||||
mod utils;
|
||||
|
||||
use crate::utils::{init, resolve, server};
|
||||
use tauri::{api, SystemTray};
|
||||
use tauri::tray::TrayIconBuilder;
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
// 单例检测
|
||||
@@ -34,14 +34,37 @@ fn main() -> std::io::Result<()> {
|
||||
|
||||
#[allow(unused_mut)]
|
||||
let mut builder = tauri::Builder::default()
|
||||
.system_tray(SystemTray::new())
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.setup(|app| {
|
||||
TrayIconBuilder::new().build(app)?;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
use tauri::menu::MenuBuilder;
|
||||
let _ = MenuBuilder::new(app)
|
||||
.copy()
|
||||
.paste()
|
||||
.undo()
|
||||
.redo()
|
||||
.cut()
|
||||
.select_all()
|
||||
.quit()
|
||||
.close_window()
|
||||
.build();
|
||||
}
|
||||
tauri::async_runtime::block_on(async move {
|
||||
resolve::resolve_setup(app).await;
|
||||
});
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.on_system_tray_event(core::tray::Tray::on_system_tray_event)
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
// common
|
||||
cmds::get_sys_proxy,
|
||||
@@ -97,26 +120,6 @@ fn main() -> std::io::Result<()> {
|
||||
cmds::clash_api_get_proxy_delay
|
||||
]);
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
use tauri::{Menu, MenuItem, Submenu};
|
||||
|
||||
builder = builder.menu(
|
||||
Menu::new().add_submenu(Submenu::new(
|
||||
"Edit",
|
||||
Menu::new()
|
||||
.add_native_item(MenuItem::Undo)
|
||||
.add_native_item(MenuItem::Redo)
|
||||
.add_native_item(MenuItem::Copy)
|
||||
.add_native_item(MenuItem::Paste)
|
||||
.add_native_item(MenuItem::Cut)
|
||||
.add_native_item(MenuItem::SelectAll)
|
||||
.add_native_item(MenuItem::CloseWindow)
|
||||
.add_native_item(MenuItem::Quit),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
let app = builder
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
@@ -125,10 +128,6 @@ fn main() -> std::io::Result<()> {
|
||||
tauri::RunEvent::ExitRequested { api, .. } => {
|
||||
api.prevent_exit();
|
||||
}
|
||||
tauri::RunEvent::Updater(tauri::UpdaterEvent::Downloaded) => {
|
||||
resolve::resolve_reset();
|
||||
api::process::kill_children();
|
||||
}
|
||||
tauri::RunEvent::WindowEvent { label, event, .. } => {
|
||||
if label == "main" {
|
||||
match event {
|
||||
|
||||
Reference in New Issue
Block a user