mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-06 09:53:43 +08:00
fix: macos use hotkey closing window can not entry auto-lightweight-mode #3326
This commit is contained in:
parent
51ef1329be
commit
1970155c51
@ -10,6 +10,7 @@
|
||||
#### 修复了:
|
||||
- 首页“代理模式”快速切换导致的卡死问题
|
||||
- 解锁测试报错信息
|
||||
- Macos 快捷键关闭窗口无法启用自动轻量模式
|
||||
|
||||
## v2.2.3
|
||||
|
||||
|
@ -109,10 +109,21 @@ pub fn quit() {
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn hide() {
|
||||
use crate::module::lightweight::add_light_weight_timer;
|
||||
|
||||
let enable_auto_light_weight_mode = Config::verge()
|
||||
.data()
|
||||
.enable_auto_light_weight_mode
|
||||
.unwrap_or(false);
|
||||
|
||||
if enable_auto_light_weight_mode {
|
||||
add_light_weight_timer();
|
||||
}
|
||||
|
||||
if let Some(window) = handle::Handle::global().get_window() {
|
||||
if window.is_visible().unwrap_or(false) {
|
||||
AppHandleManager::global().set_activation_policy_accessory();
|
||||
let _ = window.hide();
|
||||
}
|
||||
}
|
||||
AppHandleManager::global().set_activation_policy_accessory();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use tauri::{Listener, Manager};
|
||||
use crate::{
|
||||
config::Config,
|
||||
core::{handle, timer::Timer},
|
||||
log_err, logging,
|
||||
log_err, logging, logging_error,
|
||||
utils::logging::Type,
|
||||
AppHandleManager,
|
||||
};
|
||||
@ -40,6 +40,10 @@ pub fn entry_lightweight_mode() {
|
||||
let _ = cancel_light_weight_timer();
|
||||
}
|
||||
|
||||
pub fn add_light_weight_timer() {
|
||||
logging_error!(Type::Lightweight, setup_light_weight_timer());
|
||||
}
|
||||
|
||||
fn setup_window_close_listener() -> u32 {
|
||||
if let Some(window) = handle::Handle::global().get_window() {
|
||||
let handler = window.listen("tauri://close-requested", move |_event| {
|
||||
|
@ -151,8 +151,6 @@ pub fn create_window(is_showup: bool) {
|
||||
return;
|
||||
}
|
||||
|
||||
logging!(info, Type::Window, true, "Creating new application window");
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let window = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
|
Loading…
x
Reference in New Issue
Block a user