refactor: fix

This commit is contained in:
GyDi 2022-11-17 22:53:41 +08:00
parent 1880da6351
commit 5a35c5b928
No known key found for this signature in database
GPG Key ID: B28E790B95193457
2 changed files with 13 additions and 8 deletions

View File

@ -153,7 +153,12 @@ pub async fn patch_clash(patch: Mapping) -> Result<()> {
}; };
// 激活配置 // 激活配置
if mixed_port.is_some()
|| patch.get("secret").is_some()
|| patch.get("external-controller").is_some()
{
handle_activate().await?; handle_activate().await?;
}
// 更新系统代理 // 更新系统代理
if mixed_port.is_some() { if mixed_port.is_some() {

View File

@ -60,31 +60,31 @@ pub fn create_window(app_handle: &AppHandle) {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {
use crate::utils::winhelp;
use std::time::Duration; use std::time::Duration;
use tokio::time::sleep; use tokio::time::sleep;
use window_shadows::set_shadow; use window_shadows::set_shadow;
use window_vibrancy::apply_blur;
match builder match builder
.decorations(false) .decorations(false)
.transparent(true) .transparent(true)
.inner_size(800.0, 636.0) .inner_size(800.0, 636.0)
.visible(false)
.build() .build()
{ {
Ok(_) => { Ok(_) => {
let app_handle = app_handle.clone(); let app_handle = app_handle.clone();
if let Some(window) = app_handle.get_window("main") {
let _ = set_shadow(&window, true);
}
tauri::async_runtime::spawn(async move { tauri::async_runtime::spawn(async move {
sleep(Duration::from_secs(1)).await; sleep(Duration::from_secs(1)).await;
if let Some(window) = app_handle.get_window("main") { if let Some(window) = app_handle.get_window("main") {
let _ = window.show(); let _ = window.show();
let _ = set_shadow(&window, true); let _ = window.unminimize();
let _ = window.set_focus();
if !winhelp::is_win11() {
let _ = apply_blur(&window, None);
}
} }
}); });
} }