Skip to content
Snippets Groups Projects
Unverified Commit b374b9b9 authored by GyDi's avatar GyDi
Browse files

feat: open dir on the tray

parent 40371711
No related branches found
No related tags found
No related merge requests found
use crate::{config::Config, feat, utils::resolve};
use crate::{cmds, config::Config, feat, utils::resolve};
use anyhow::Result;
use tauri::{
api, AppHandle, CustomMenuItem, Manager, SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem,
......@@ -24,6 +24,13 @@ impl Tray {
.add_native_item(SystemTrayMenuItem::Separator)
.add_item(CustomMenuItem::new("system_proxy", "系统代理"))
.add_item(CustomMenuItem::new("tun_mode", "TUN 模式"))
.add_submenu(SystemTraySubmenu::new(
"打开目录",
SystemTrayMenu::new()
.add_item(CustomMenuItem::new("open_app_dir", "应用目录"))
.add_item(CustomMenuItem::new("open_core_dir", "内核目录"))
.add_item(CustomMenuItem::new("open_logs_dir", "日志目录")),
))
.add_submenu(SystemTraySubmenu::new(
"更多",
SystemTrayMenu::new()
......@@ -47,6 +54,13 @@ impl Tray {
.add_native_item(SystemTrayMenuItem::Separator)
.add_item(CustomMenuItem::new("system_proxy", "System Proxy"))
.add_item(CustomMenuItem::new("tun_mode", "Tun Mode"))
.add_submenu(SystemTraySubmenu::new(
"Open Dir",
SystemTrayMenu::new()
.add_item(CustomMenuItem::new("open_app_dir", "App Dir"))
.add_item(CustomMenuItem::new("open_core_dir", "Core Dir"))
.add_item(CustomMenuItem::new("open_logs_dir", "Logs Dir")),
))
.add_submenu(SystemTraySubmenu::new(
"More",
SystemTrayMenu::new()
......@@ -110,6 +124,9 @@ impl Tray {
"open_window" => resolve::create_window(app_handle),
"system_proxy" => feat::toggle_system_proxy(),
"tun_mode" => feat::toggle_tun_mode(),
"open_app_dir" => crate::log_err!(cmds::open_app_dir()),
"open_core_dir" => crate::log_err!(cmds::open_core_dir()),
"open_logs_dir" => crate::log_err!(cmds::open_logs_dir()),
"restart_clash" => feat::restart_clash_core(),
"restart_app" => api::process::restart(&app_handle.env()),
"quit" => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment