mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-25 23:15:51 +08:00
fix(linux): show window after page load #7002
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
- 修复系统代理关闭序列逻辑(防止快速退出时系统代理关闭状态没有保存)
|
||||
- 修复 Linux 快捷键映射错误
|
||||
- 修复 Linux Wayland 兼容性导致渲染错误
|
||||
- 修复 Linux 边缘情况无法加载页面
|
||||
|
||||
### ✨ 新增功能
|
||||
|
||||
|
||||
@@ -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<WebviewWindow, String> {
|
||||
.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));
|
||||
|
||||
@@ -53,16 +53,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="initial-loading-overlay"></div>
|
||||
<script>
|
||||
if (window.__TAURI_INTERNALS__) {
|
||||
window.__TAURI_INTERNALS__
|
||||
.invoke('plugin:window|show', { label: 'main' })
|
||||
.catch(function () {});
|
||||
window.__TAURI_INTERNALS__
|
||||
.invoke('plugin:window|set_focus', { label: 'main' })
|
||||
.catch(function () {});
|
||||
}
|
||||
</script>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./main.tsx"></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user