diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 4cdbf49..ac1b518 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -5,6 +5,7 @@ "windows": ["main"], "permissions": [ "core:default", - "opener:default" + "opener:default", + "core:window:allow-show" ] } diff --git a/src-tauri/src/launcher/auth.rs b/src-tauri/src/launcher/auth.rs index ecc45fd..ffb4760 100644 --- a/src-tauri/src/launcher/auth.rs +++ b/src-tauri/src/launcher/auth.rs @@ -50,7 +50,8 @@ pub fn auth_create_link(app: AppHandle) -> Result { let app_handle = app.clone(); - tauri::WebviewWindowBuilder::new(&app, "auth", tauri::WebviewUrl::External(url)) + std::thread::spawn(move || { + tauri::WebviewWindowBuilder::new(&app, "auth", tauri::WebviewUrl::External(url)) .title("Microsoft Login") .inner_size(500.0, 700.0) .resizable(false) @@ -74,7 +75,8 @@ pub fn auth_create_link(app: AppHandle) -> Result { true }) .build() - .map_err(|e| e.to_string())?; + .map_err(|e| e.to_string()).unwrap(); + }); Ok(link) } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 81ac13b..ec87aae 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -14,7 +14,9 @@ { "title": "saturn-launcher", "width": 1000, - "height": 650 + "height": 650, + "backgroundColor": "#0a0a0a", + "visible": false } ], "security": { diff --git a/src/App.tsx b/src/App.tsx index 5e048f4..224b5df 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,6 +8,7 @@ import { versions } from "./lib/launcher"; import { GameVersion } from "./lib/types"; import { MinecraftAccount } from "./lib/auth"; import { getVersion, updateVersion } from "./lib/saturn"; +import { getCurrentWindow } from "@tauri-apps/api/window"; type Section = "play" | "mods" | "settings"; @@ -61,6 +62,12 @@ export default function App() { if (selectedVersion?.id) updateVersion(selectedVersion?.id); }, [selectedVersion]); + useEffect(() => { + const window = getCurrentWindow(); + + window.show(); + }, []); + return (