diff --git a/src-tauri/src/core/hotkey.rs b/src-tauri/src/core/hotkey.rs index b55babbe653f40a06ee91871bcd8ecaef60ef07b..cd4c149194f2eb553ea297e48d471648f8ca5e4f 100644 --- a/src-tauri/src/core/hotkey.rs +++ b/src-tauri/src/core/hotkey.rs @@ -76,6 +76,7 @@ impl Hotkey { } let f = match func.trim() { + "open_dashboard" => || feat::open_dashboard(), "clash_mode_rule" => || feat::change_clash_mode("rule".into()), "clash_mode_global" => || feat::change_clash_mode("global".into()), "clash_mode_direct" => || feat::change_clash_mode("direct".into()), diff --git a/src-tauri/src/feat.rs b/src-tauri/src/feat.rs index a3a0768e0378c655bb37aa14551d9212cd2b2ddf..a446c2793bfabe6c18956cfda6e940279bb92ca1 100644 --- a/src-tauri/src/feat.rs +++ b/src-tauri/src/feat.rs @@ -7,10 +7,20 @@ use crate::config::*; use crate::core::*; use crate::log_err; +use crate::utils::resolve; use anyhow::{bail, Result}; use serde_yaml::{Mapping, Value}; use wry::application::clipboard::Clipboard; +// æ‰“å¼€é¢æ¿ +pub fn open_dashboard() { + let handle = handle::Handle::global(); + let app_handle = handle.app_handle.lock(); + if let Some(app_handle) = app_handle.as_ref() { + resolve::create_window(app_handle); + } +} + // é‡å¯clash pub fn restart_clash_core() { tauri::async_runtime::spawn(async { diff --git a/src/components/setting/mods/hotkey-viewer.tsx b/src/components/setting/mods/hotkey-viewer.tsx index 41879f1e5cf3dba3c69db6ffecb8706f3b830c34..a47d30e62d1f60987f9e9e0769c7c9dea4c82712 100644 --- a/src/components/setting/mods/hotkey-viewer.tsx +++ b/src/components/setting/mods/hotkey-viewer.tsx @@ -14,6 +14,7 @@ const ItemWrapper = styled("div")` `; const HOTKEY_FUNC = [ + "open_dashboard", "clash_mode_rule", "clash_mode_global", "clash_mode_direct", diff --git a/src/locales/en.json b/src/locales/en.json index 1ac4a0e4f3943b0e535ac78c9d1f45eff173d1a1..eedfcfd034e25c72599b1e3d8c90652486a8b340 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -108,6 +108,7 @@ "Download Speed": "Download Speed", "Upload Speed": "Upload Speed", + "open_dashboard": "Open Dashboard", "clash_mode_rule": "Rule Mode", "clash_mode_global": "Global Mode", "clash_mode_direct": "Direct Mode", diff --git a/src/locales/ru.json b/src/locales/ru.json index 58eac6d2c16eb27db2e209b61f5741e058063ab3..f8ea10be28857fe7bd77dd1f98989ecb6ab0fbdf 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -97,6 +97,7 @@ "Save": "Сохранить", "Cancel": "Отмена", + "open_dashboard": "Open Dashboard", "clash_mode_rule": "Режим правил", "clash_mode_global": "Глобальный режим", "clash_mode_direct": "ПрÑмой режим", diff --git a/src/locales/zh.json b/src/locales/zh.json index 26964be0f20213dd3e64fc6b0b2979a89288cb30..b70f738f4e91453c97248417c0c2aeb04c141132 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -108,6 +108,7 @@ "Download Speed": "下载速度", "Upload Speed": "ä¸Šä¼ é€Ÿåº¦", + "open_dashboard": "æ‰“å¼€é¢æ¿", "clash_mode_rule": "规则模å¼", "clash_mode_global": "全局模å¼", "clash_mode_direct": "直连模å¼",