diff --git a/UPDATELOG.md b/UPDATELOG.md index e1f27d75..df560bfe 100644 --- a/UPDATELOG.md +++ b/UPDATELOG.md @@ -20,7 +20,9 @@ - 修复 Linux 无法与 Mihomo 核心 和 ClashVergeRev 服务通信 3. **界面** - 修复 连接详情卡没有跟随主题色 - +4. **轻量模式** + - 修复 MacOS 轻量模式下 Dock 栏图标无法隐藏。 + 新增了: 1. **首页** - 首页文本过长自动截断 diff --git a/src-tauri/src/core/hotkey.rs b/src-tauri/src/core/hotkey.rs index e5bcc7df..4b941036 100755 --- a/src-tauri/src/core/hotkey.rs +++ b/src-tauri/src/core/hotkey.rs @@ -1,4 +1,7 @@ -use crate::{config::Config, core::handle, feat, log_err, utils::resolve}; +use crate::{ + config::Config, core::handle, feat, log_err, module::lightweight::entry_lightweight_mode, + utils::resolve, +}; use anyhow::{bail, Result}; use once_cell::sync::OnceCell; use parking_lot::Mutex; @@ -147,7 +150,7 @@ impl Hotkey { "clash_mode_direct" => || feat::change_clash_mode("direct".into()), "toggle_system_proxy" => || feat::toggle_system_proxy(), "toggle_tun_mode" => || feat::toggle_tun_mode(None), - "entry_lightweight_mode" => || feat::lightweight_mode(), + "entry_lightweight_mode" => || entry_lightweight_mode(), "quit" => || feat::quit(Some(0)), #[cfg(target_os = "macos")] "hide" => || feat::hide(), diff --git a/src-tauri/src/core/tray/mod.rs b/src-tauri/src/core/tray/mod.rs index 166b151e..ccce0468 100644 --- a/src-tauri/src/core/tray/mod.rs +++ b/src-tauri/src/core/tray/mod.rs @@ -6,7 +6,7 @@ use crate::{ cmd, config::Config, feat, - module::mihomo::Rate, + module::{lightweight::entry_lightweight_mode, mihomo::Rate}, resolve, utils::{dirs, i18n::t, resolve::VERSION}, }; @@ -663,7 +663,7 @@ fn on_menu_event(_: &AppHandle, event: MenuEvent) { "open_logs_dir" => crate::log_err!(cmd::open_logs_dir()), "restart_clash" => feat::restart_clash_core(), "restart_app" => feat::restart_app(), - "entry_lightweight_mode" => feat::lightweight_mode(), + "entry_lightweight_mode" => entry_lightweight_mode(), "quit" => { println!("quit"); feat::quit(Some(0)); diff --git a/src-tauri/src/feat/lightweight.rs b/src-tauri/src/feat/lightweight.rs index 6e64f0f6..8b137891 100644 --- a/src-tauri/src/feat/lightweight.rs +++ b/src-tauri/src/feat/lightweight.rs @@ -1,6 +1 @@ -use crate::module::lightweight::entry_lightweight_mode; -pub fn lightweight_mode() { - log::info!(target: "app","Lightweight mode enabled"); - entry_lightweight_mode(); -} diff --git a/src-tauri/src/feat/mod.rs b/src-tauri/src/feat/mod.rs index 32814194..c45d9f07 100644 --- a/src-tauri/src/feat/mod.rs +++ b/src-tauri/src/feat/mod.rs @@ -10,7 +10,6 @@ mod window; pub use backup::*; pub use clash::*; pub use config::*; -pub use lightweight::*; pub use profile::*; pub use proxy::*; pub use window::*; diff --git a/src-tauri/src/module/lightweight.rs b/src-tauri/src/module/lightweight.rs index 224b75e6..659ced9a 100644 --- a/src-tauri/src/module/lightweight.rs +++ b/src-tauri/src/module/lightweight.rs @@ -5,7 +5,7 @@ use tauri::{Listener, Manager}; use crate::{ config::Config, core::{handle, timer::Timer}, - log_err, + log_err, AppHandleManager, }; const LIGHT_WEIGHT_TASK_UID: &str = "light_weight_task"; @@ -32,6 +32,7 @@ pub fn entry_lightweight_mode() { if let Some(webview) = window.get_webview_window("main") { let _ = webview.destroy(); } + AppHandleManager::global().set_activation_policy_accessory(); println!("[lightweight_mode] 轻量模式已开启"); log::info!(target: "app", "[lightweight_mode] 轻量模式已开启"); }