diff --git a/Changelog.md b/Changelog.md index 9d8fbee24..feac56b1a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,7 @@ - 修复系统代理关闭序列逻辑(防止快速退出时系统代理关闭状态没有保存) - 修复 Linux 快捷键映射错误 - 修复 Linux Wayland 兼容性导致渲染错误 +- 修复 Linux 边缘情况无法加载页面 ### ✨ 新增功能 diff --git a/src-tauri/src/utils/resolve/window.rs b/src-tauri/src/utils/resolve/window.rs index 1fa2a43f1..8c8a8a12d 100644 --- a/src-tauri/src/utils/resolve/window.rs +++ b/src-tauri/src/utils/resolve/window.rs @@ -1,5 +1,6 @@ use dark_light::{Mode as SystemTheme, detect as detect_system_theme}; use tauri::utils::config::Color; +use tauri::webview::PageLoadEvent; use tauri::{Theme, WebviewWindow}; use crate::{config::Config, core::handle, utils::resolve::window_script::build_window_initial_script}; @@ -67,7 +68,15 @@ pub async fn build_new_window() -> Result { .inner_size(DEFAULT_WIDTH, DEFAULT_HEIGHT) .min_inner_size(MINIMAL_WIDTH, MINIMAL_HEIGHT) .visible(false) // 等待主题色准备好后再展示,避免启动色差 - .initialization_script(&initial_script); + .initialization_script(&initial_script) + .on_page_load(move |window, payload| { + if payload.event() != PageLoadEvent::Finished { + return; + } + + logging_error!(Type::Window, window.show()); + logging_error!(Type::Window, window.set_focus()); + }); if let Some(theme) = resolved_theme { builder = builder.theme(Some(theme)); diff --git a/src/index.html b/src/index.html index 2a7238e06..4bf22a5a9 100644 --- a/src/index.html +++ b/src/index.html @@ -53,16 +53,6 @@
-