diff --git a/apps/stage-tamagotchi/src-tauri/src/app/windows/settings.rs b/apps/stage-tamagotchi/src-tauri/src/app/windows/settings.rs index 724156690..a5df369c0 100644 --- a/apps/stage-tamagotchi/src-tauri/src/app/windows/settings.rs +++ b/apps/stage-tamagotchi/src-tauri/src/app/windows/settings.rs @@ -3,12 +3,18 @@ use std::{path::Path, sync::Arc}; use anyhow::{Ok, Result}; #[cfg(target_os = "macos")] use tauri::TitleBarStyle; -use tauri::{Runtime, WebviewUrl, WebviewWindowBuilder, webview::PageLoadPayload}; +use tauri::{Manager, Runtime, WebviewUrl, WebviewWindowBuilder, webview::PageLoadPayload}; pub fn new_settings_window( app: &tauri::AppHandle, page_load_handler: Option, PageLoadPayload) + Send + Sync>>, ) -> Result> { + if let Some(window) = app.get_webview_window("settings") { + _ = window.show(); + _ = window.set_focus(); + return Ok(window); + } + let mut builder = WebviewWindowBuilder::new( app, "settings", diff --git a/apps/stage-tamagotchi/src-tauri/src/lib.rs b/apps/stage-tamagotchi/src-tauri/src/lib.rs index dec15e204..6dcf05ea4 100644 --- a/apps/stage-tamagotchi/src-tauri/src/lib.rs +++ b/apps/stage-tamagotchi/src-tauri/src/lib.rs @@ -151,12 +151,6 @@ pub fn run() { app.exit(0); } "settings" => { - let window = app.get_webview_window("settings"); - if let Some(window) = window { - let _ = window.show(); - return; - } - app::windows::settings::new_settings_window(app, None).unwrap(); } "window-mode.fade-on-hover" => {