diff --git a/src-tauri/src/commands/window.rs b/src-tauri/src/commands/window.rs index 00fd06d..843e6fa 100644 --- a/src-tauri/src/commands/window.rs +++ b/src-tauri/src/commands/window.rs @@ -1,6 +1,7 @@ use parking_lot::RwLock; use std::sync::Arc; use tauri::AppHandle; +#[cfg(desktop)] use tauri::Manager; use crate::state::AppState; @@ -27,32 +28,28 @@ pub async fn window_maximize( app: AppHandle, _state: tauri::State<'_, Arc>>, ) -> Result { + #[cfg(not(desktop))] + { + let _ = app; + return Ok(false); + } + #[cfg(desktop)] { if let Some(window) = app.get_webview_window("main") { - let is_maximized = window.is_maximized().map_err(|e| e.to_string())?; + let is_maximized = window.is_maximized().map_err(|e| e.to_string())?; - if is_maximized { - window.unmaximize().map_err(|e| e.to_string())?; - Ok(false) - } else { - window.maximize().map_err(|e| e.to_string())?; - Ok(true) - } + if is_maximized { + window.unmaximize().map_err(|e| e.to_string())?; + Ok(false) + } else { + window.maximize().map_err(|e| e.to_string())?; + Ok(true) + } } else { Err("Window not found".to_string()) } } - - #[cfg(not(desktop))] - { - if let Some(window) = app.get_webview_window("main") { - window.set_fullscreen(true).map_err(|e| e.to_string())?; - Ok(true) - } else { - Ok(false) - } - } } #[tauri::command] @@ -77,19 +74,16 @@ pub async fn window_is_maximized( app: AppHandle, _state: tauri::State<'_, Arc>>, ) -> Result { + #[cfg(not(desktop))] + { + let _ = app; + return Ok(false); + } + #[cfg(desktop)] { if let Some(window) = app.get_webview_window("main") { - window.is_maximized().map_err(|e| e.to_string()) - } else { - Ok(false) - } - } - - #[cfg(not(desktop))] - { - if let Some(window) = app.get_webview_window("main") { - window.is_fullscreen().map_err(|e| e.to_string()) + window.is_maximized().map_err(|e| e.to_string()) } else { Ok(false) } @@ -124,6 +118,12 @@ pub async fn window_resize( app: AppHandle, _state: tauri::State<'_, Arc>>, ) -> Result<(), String> { + #[cfg(not(desktop))] + { + let _ = (width, height, app); + } + + #[cfg(desktop)] if let Some(window) = app.get_webview_window("main") { window .set_size(tauri::Size::Physical(tauri::PhysicalSize { width, height })) @@ -138,6 +138,12 @@ pub async fn window_set_resizable( app: AppHandle, _state: tauri::State<'_, Arc>>, ) -> Result<(), String> { + #[cfg(not(desktop))] + { + let _ = (resizable, app); + } + + #[cfg(desktop)] if let Some(window) = app.get_webview_window("main") { window.set_resizable(resizable).map_err(|e| e.to_string())?; } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 96272a9..944630d 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -298,6 +298,12 @@ fn setup_tray(_app: &mut App) -> Result<(), Box> { #[cfg(desktop)] fn setup_window_events(app: &mut App) -> Result<(), Box> { if let Some(window) = app.get_webview_window("main") { + let _ = window.set_size(tauri::Size::Physical(tauri::PhysicalSize { + width: 1180, + height: 680, + })); + let _ = window.center(); + #[cfg(target_os = "macos")] { let _ = window.set_shadow(true); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 8ca26ee..bc9e2ff 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -15,8 +15,8 @@ "windows": [ { "title": "SecScore", - "width": 1180, - "height": 680, + "width": 10000, + "height": 10000, "resizable": true, "fullscreen": false, "decorations": false,