fix: add macOS specific activation policy handling for silent start (#3740)
* fix: add macOS specific activation policy handling for silent start * fix: resolve abnormal Dock icon launch during macOS silent startup
This commit is contained in:
committed by
GitHub
Unverified
parent
41ba8f6c7a
commit
032e5bf32e
@@ -38,6 +38,7 @@
|
||||
- 修复提权漏洞,改用带认证的 IPC 通信机制
|
||||
- 修复静默启动无法使用自动轻量模式
|
||||
- 修复 JS 脚本转义特殊字符报错
|
||||
- 修复 macOS 静默启动时异常启动 Dock 栏图标
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#[cfg(target_os = "macos")]
|
||||
use crate::AppHandleManager;
|
||||
use crate::{
|
||||
config::{Config, IVerge, PrfItem},
|
||||
core::*,
|
||||
@@ -218,6 +220,14 @@ pub async fn resolve_setup_async(app_handle: &AppHandle) {
|
||||
|
||||
// 创建窗口
|
||||
let is_silent_start = { Config::verge().data().enable_silent_start }.unwrap_or(false);
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
if is_silent_start {
|
||||
use crate::AppHandleManager;
|
||||
|
||||
AppHandleManager::global().set_activation_policy_accessory();
|
||||
}
|
||||
}
|
||||
create_window(!is_silent_start);
|
||||
|
||||
// 初始化定时器
|
||||
@@ -414,6 +424,10 @@ pub fn create_window(is_show: bool) -> bool {
|
||||
let _ = window_clone.show();
|
||||
let _ = window_clone.set_focus();
|
||||
logging!(info, Type::Window, true, "窗口已立即显示");
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
AppHandleManager::global().set_activation_policy_regular();
|
||||
}
|
||||
|
||||
let timeout_seconds = if crate::module::lightweight::is_in_lightweight_mode() {
|
||||
3
|
||||
|
||||
Reference in New Issue
Block a user