feat: add Open Dashboard to the hotkey, close #723

This commit is contained in:
GyDi 2023-09-10 14:46:03 +08:00
parent f4c7b17a87
commit 3efd575dd2
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A
6 changed files with 15 additions and 0 deletions

View File

@ -76,6 +76,7 @@ impl Hotkey {
} }
let f = match func.trim() { let f = match func.trim() {
"open_dashboard" => || feat::open_dashboard(),
"clash_mode_rule" => || feat::change_clash_mode("rule".into()), "clash_mode_rule" => || feat::change_clash_mode("rule".into()),
"clash_mode_global" => || feat::change_clash_mode("global".into()), "clash_mode_global" => || feat::change_clash_mode("global".into()),
"clash_mode_direct" => || feat::change_clash_mode("direct".into()), "clash_mode_direct" => || feat::change_clash_mode("direct".into()),

View File

@ -7,10 +7,20 @@
use crate::config::*; use crate::config::*;
use crate::core::*; use crate::core::*;
use crate::log_err; use crate::log_err;
use crate::utils::resolve;
use anyhow::{bail, Result}; use anyhow::{bail, Result};
use serde_yaml::{Mapping, Value}; use serde_yaml::{Mapping, Value};
use wry::application::clipboard::Clipboard; 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 // 重启clash
pub fn restart_clash_core() { pub fn restart_clash_core() {
tauri::async_runtime::spawn(async { tauri::async_runtime::spawn(async {

View File

@ -14,6 +14,7 @@ const ItemWrapper = styled("div")`
`; `;
const HOTKEY_FUNC = [ const HOTKEY_FUNC = [
"open_dashboard",
"clash_mode_rule", "clash_mode_rule",
"clash_mode_global", "clash_mode_global",
"clash_mode_direct", "clash_mode_direct",

View File

@ -108,6 +108,7 @@
"Download Speed": "Download Speed", "Download Speed": "Download Speed",
"Upload Speed": "Upload Speed", "Upload Speed": "Upload Speed",
"open_dashboard": "Open Dashboard",
"clash_mode_rule": "Rule Mode", "clash_mode_rule": "Rule Mode",
"clash_mode_global": "Global Mode", "clash_mode_global": "Global Mode",
"clash_mode_direct": "Direct Mode", "clash_mode_direct": "Direct Mode",

View File

@ -97,6 +97,7 @@
"Save": "Сохранить", "Save": "Сохранить",
"Cancel": "Отмена", "Cancel": "Отмена",
"open_dashboard": "Open Dashboard",
"clash_mode_rule": "Режим правил", "clash_mode_rule": "Режим правил",
"clash_mode_global": "Глобальный режим", "clash_mode_global": "Глобальный режим",
"clash_mode_direct": "Прямой режим", "clash_mode_direct": "Прямой режим",

View File

@ -108,6 +108,7 @@
"Download Speed": "下载速度", "Download Speed": "下载速度",
"Upload Speed": "上传速度", "Upload Speed": "上传速度",
"open_dashboard": "打开面板",
"clash_mode_rule": "规则模式", "clash_mode_rule": "规则模式",
"clash_mode_global": "全局模式", "clash_mode_global": "全局模式",
"clash_mode_direct": "直连模式", "clash_mode_direct": "直连模式",