From 8d2ceef9b91ef2fcd2557c4c461bf285355f8c74 Mon Sep 17 00:00:00 2001 From: VirtualHotBar <96966978+VirtualHotBar@users.noreply.github.com> Date: Thu, 26 Mar 2026 12:21:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(tray):=20=E6=B7=BB=E5=8A=A0=E6=89=98?= =?UTF-8?q?=E7=9B=98=E8=8F=9C=E5=8D=95'=E9=87=8D=E5=90=AF=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F'=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在右键托盘菜单中添加'重启程序'菜单项 - 支持多语言:简体中文、繁体中文、英文 - 点击后调用 Tauri 的 restart() 方法一键重启软件 --- src-tauri/locales/en.json | 1 + src-tauri/locales/zh-cn.json | 1 + src-tauri/locales/zh-hant.json | 1 + src-tauri/src/tray.rs | 4 ++++ 4 files changed, 7 insertions(+) diff --git a/src-tauri/locales/en.json b/src-tauri/locales/en.json index 3792874..2c0f476 100644 --- a/src-tauri/locales/en.json +++ b/src-tauri/locales/en.json @@ -205,6 +205,7 @@ "openlist_extra_args": "OpenList Extra Startup Args", "quit": "Quit", "tray_show": "Show Main Window", + "tray_restart": "Restart Program", "open_log_dir": "Open Log Folder", "export_diagnostics": "Export Diagnostics", "diagnostics_exported": "Diagnostics exported", diff --git a/src-tauri/locales/zh-cn.json b/src-tauri/locales/zh-cn.json index d036f00..a29c7ca 100644 --- a/src-tauri/locales/zh-cn.json +++ b/src-tauri/locales/zh-cn.json @@ -205,6 +205,7 @@ "openlist_extra_args": "OpenList 启动参数", "quit": "退出", "tray_show": "显示主窗口", + "tray_restart": "重启程序", "open_log_dir": "打开日志目录", "export_diagnostics": "导出诊断包", "diagnostics_exported": "诊断包已导出", diff --git a/src-tauri/locales/zh-hant.json b/src-tauri/locales/zh-hant.json index 917a74b..88e95ed 100644 --- a/src-tauri/locales/zh-hant.json +++ b/src-tauri/locales/zh-hant.json @@ -205,6 +205,7 @@ "openlist_extra_args": "OpenList 額外啟動參數", "quit": "退出", "tray_show": "顯示主視窗", + "tray_restart": "重啟程式", "open_log_dir": "打開日誌目錄", "export_diagnostics": "匯出診斷包", "diagnostics_exported": "診斷包已匯出", diff --git a/src-tauri/src/tray.rs b/src-tauri/src/tray.rs index dbd40e2..3f6d443 100644 --- a/src-tauri/src/tray.rs +++ b/src-tauri/src/tray.rs @@ -14,6 +14,7 @@ impl Tray { let menu = tauri::menu::MenuBuilder::new(app) .items(&[ &build_item("show", locale.get("tray_show"))?, + &build_item("restart", locale.get("tray_restart"))?, &build_item("quit", locale.get("quit"))?, ]) .build() @@ -45,6 +46,9 @@ impl Tray { let _ = window.toggle_visibility(Some(true)); } } + "restart" => { + app.restart(); + } "quit" => { app.app_quit(); }