mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat(tray): close all connections (#5165)
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
- 新增本地备份功能
|
- 新增本地备份功能
|
||||||
- 主界面“当前节点”卡片新增自动延迟检测开关(默认关闭)
|
- 主界面“当前节点”卡片新增自动延迟检测开关(默认关闭)
|
||||||
- 允许独立控制订阅自动更新
|
- 允许独立控制订阅自动更新
|
||||||
|
- 托盘 `更多` 中新增 `关闭所有连接` 按钮
|
||||||
|
|
||||||
### 🚀 优化改进
|
### 🚀 优化改进
|
||||||
|
|
||||||
|
|||||||
@@ -840,6 +840,7 @@ async fn create_tray_menu(
|
|||||||
let proxies_text = t("Proxies").await;
|
let proxies_text = t("Proxies").await;
|
||||||
let system_proxy_text = t("System Proxy").await;
|
let system_proxy_text = t("System Proxy").await;
|
||||||
let tun_mode_text = t("TUN Mode").await;
|
let tun_mode_text = t("TUN Mode").await;
|
||||||
|
let close_all_connections_text = t("Close All Connections").await;
|
||||||
let lightweight_mode_text = t("LightWeight Mode").await;
|
let lightweight_mode_text = t("LightWeight Mode").await;
|
||||||
let copy_env_text = t("Copy Env").await;
|
let copy_env_text = t("Copy Env").await;
|
||||||
let conf_dir_text = t("Conf Dir").await;
|
let conf_dir_text = t("Conf Dir").await;
|
||||||
@@ -949,6 +950,14 @@ async fn create_tray_menu(
|
|||||||
hotkeys.get("toggle_tun_mode").map(|s| s.as_str()),
|
hotkeys.get("toggle_tun_mode").map(|s| s.as_str()),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
let close_all_connections = &MenuItem::with_id(
|
||||||
|
app_handle,
|
||||||
|
"close_all_connections",
|
||||||
|
close_all_connections_text,
|
||||||
|
true,
|
||||||
|
None::<&str>,
|
||||||
|
)?;
|
||||||
|
|
||||||
let lighteweight_mode = &CheckMenuItem::with_id(
|
let lighteweight_mode = &CheckMenuItem::with_id(
|
||||||
app_handle,
|
app_handle,
|
||||||
"entry_lightweight_mode",
|
"entry_lightweight_mode",
|
||||||
@@ -1021,7 +1030,12 @@ async fn create_tray_menu(
|
|||||||
"more",
|
"more",
|
||||||
more_text,
|
more_text,
|
||||||
true,
|
true,
|
||||||
&[restart_clash, restart_app, app_version],
|
&[
|
||||||
|
close_all_connections,
|
||||||
|
restart_clash,
|
||||||
|
restart_app,
|
||||||
|
app_version,
|
||||||
|
],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let quit = &MenuItem::with_id(app_handle, "quit", exit_text, true, Some("CmdOrControl+Q"))?;
|
let quit = &MenuItem::with_id(app_handle, "quit", exit_text, true, Some("CmdOrControl+Q"))?;
|
||||||
@@ -1091,6 +1105,11 @@ fn on_menu_event(_: &AppHandle, event: MenuEvent) {
|
|||||||
"tun_mode" => {
|
"tun_mode" => {
|
||||||
feat::toggle_tun_mode(None).await;
|
feat::toggle_tun_mode(None).await;
|
||||||
}
|
}
|
||||||
|
"close_all_connections" => {
|
||||||
|
if let Err(err) = handle::Handle::mihomo().await.close_all_connections().await {
|
||||||
|
log::error!(target: "app", "Failed to close all connections from tray: {err}");
|
||||||
|
}
|
||||||
|
}
|
||||||
"copy_env" => feat::copy_clash_env().await,
|
"copy_env" => feat::copy_clash_env().await,
|
||||||
"open_app_dir" => {
|
"open_app_dir" => {
|
||||||
let _ = cmd::open_app_dir().await;
|
let _ = cmd::open_app_dir().await;
|
||||||
|
|||||||
@@ -182,6 +182,7 @@
|
|||||||
"Table View": "Table View",
|
"Table View": "Table View",
|
||||||
"List View": "List View",
|
"List View": "List View",
|
||||||
"Close All": "Close All",
|
"Close All": "Close All",
|
||||||
|
"Close All Connections": "Close All Connections",
|
||||||
"Upload": "Upload",
|
"Upload": "Upload",
|
||||||
"Download": "Download",
|
"Download": "Download",
|
||||||
"Download Speed": "Download Speed",
|
"Download Speed": "Download Speed",
|
||||||
|
|||||||
@@ -182,6 +182,7 @@
|
|||||||
"Table View": "表格视图",
|
"Table View": "表格视图",
|
||||||
"List View": "列表视图",
|
"List View": "列表视图",
|
||||||
"Close All": "关闭全部",
|
"Close All": "关闭全部",
|
||||||
|
"Close All Connections": "关闭所有连接",
|
||||||
"Upload": "上传",
|
"Upload": "上传",
|
||||||
"Download": "下载",
|
"Download": "下载",
|
||||||
"Download Speed": "下载速度",
|
"Download Speed": "下载速度",
|
||||||
|
|||||||
Reference in New Issue
Block a user