Skip to content

Commit

Permalink
Avoid white flash on launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Barafu committed Oct 15, 2024
1 parent a2523cf commit 90a94ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"permissions": [
"core:default",
"process:default"

"process:default",
"core:window:allow-show"
]
}
6 changes: 5 additions & 1 deletion src-tauri/src/dream_runner.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::app_settings::SETTINGS;
use anyhow::{Ok, Result};

/// Displays dreams. Loads settings, creates windows, chooses a dream and runs it.
#[derive(Debug)]
Expand All @@ -27,6 +26,7 @@ impl DreamRunner {
tauri::WebviewUrl::App("index.html".into()),
)
.fullscreen(FULLSCREEN)
.visible(false)
.build()?;

if need_multiscreen {
Expand All @@ -45,6 +45,7 @@ impl DreamRunner {
.position(pos.0, pos.1)
//.inner_size(size.0, size.1)
//.fullscreen(true)
.visible(false)
.build()?;
secondary_window.set_fullscreen(FULLSCREEN)?;
}
Expand All @@ -60,6 +61,9 @@ impl DreamRunner {
}
}

#[tauri::command]
fn window_finished_loading() {}

fn compare_monitors(a: &tauri::window::Monitor, b: &tauri::window::Monitor) -> bool {
a.name() == b.name() && a.position() == b.position() && a.size() == b.size()
}
Expand Down
5 changes: 5 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { exit } from '@tauri-apps/plugin-process';
//import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
import { getCurrentWindow } from "@tauri-apps/api/window";

import { clock } from "./dreams/clocks";
import { dendraClock } from "./dreams/dendraclock";
Expand Down Expand Up @@ -33,6 +35,9 @@ function animate() {
window.addEventListener("DOMContentLoaded", () => {
resizeCanvas();
animate();

const appWindow = getCurrentWindow();
appWindow.show();
});


0 comments on commit 90a94ed

Please sign in to comment.