Skip to content

Commit

Permalink
refactor: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzgydi committed Nov 17, 2022
1 parent 1880da6 commit 5a35c5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src-tauri/src/feat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ pub async fn patch_clash(patch: Mapping) -> Result<()> {
};

// 激活配置
handle_activate().await?;
if mixed_port.is_some()
|| patch.get("secret").is_some()
|| patch.get("external-controller").is_some()
{
handle_activate().await?;
}

// 更新系统代理
if mixed_port.is_some() {
Expand Down
14 changes: 7 additions & 7 deletions src-tauri/src/utils/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,31 @@ pub fn create_window(app_handle: &AppHandle) {

#[cfg(target_os = "windows")]
{
use crate::utils::winhelp;
use std::time::Duration;
use tokio::time::sleep;
use window_shadows::set_shadow;
use window_vibrancy::apply_blur;

match builder
.decorations(false)
.transparent(true)
.inner_size(800.0, 636.0)
.visible(false)
.build()
{
Ok(_) => {
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 {
sleep(Duration::from_secs(1)).await;

if let Some(window) = app_handle.get_window("main") {
let _ = window.show();
let _ = set_shadow(&window, true);

if !winhelp::is_win11() {
let _ = apply_blur(&window, None);
}
let _ = window.unminimize();
let _ = window.set_focus();
}
});
}
Expand Down

0 comments on commit 5a35c5b

Please sign in to comment.