🐛 Solve the problem of window remembering position

This commit is contained in:
Tw93
2025-08-22 16:29:30 +08:00
parent 950b1a73cb
commit 1e704cf617
4 changed files with 12 additions and 6 deletions

2
dist/cli.js vendored
View File

@@ -22,7 +22,7 @@ import sharp from 'sharp';
import * as psl from 'psl';
var name = "pake-cli";
var version = "3.2.12";
var version = "3.2.13";
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
var engines = {
node: ">=16.0.0"

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "pake-cli",
"version": "3.2.11",
"version": "3.2.12",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pake-cli",
"version": "3.2.11",
"version": "3.2.12",
"license": "MIT",
"dependencies": {
"@tauri-apps/api": "^2.8.0",

View File

@@ -1,6 +1,6 @@
{
"name": "pake-cli",
"version": "3.2.12",
"version": "3.2.13",
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
"engines": {
"node": ">=16.0.0"

View File

@@ -51,8 +51,14 @@ pub fn run_app() {
let window = set_window(app, &pake_config, &tauri_config);
set_system_tray(app.app_handle(), show_system_tray).unwrap();
set_global_shortcut(app.app_handle(), activation_shortcut).unwrap();
// Prevent flickering on the first open.
window.show().unwrap();
// Show window after state restoration to prevent position flashing
let window_clone = window.clone();
tauri::async_runtime::spawn(async move {
tokio::time::sleep(tokio::time::Duration::from_millis(50)).await;
window_clone.show().unwrap();
});
Ok(())
})
.on_window_event(move |_window, _event| {