diff --git a/src-tauri/src/commands/window.rs b/src-tauri/src/commands/window.rs index 843e6fa..00fd06d 100644 --- a/src-tauri/src/commands/window.rs +++ b/src-tauri/src/commands/window.rs @@ -1,7 +1,6 @@ use parking_lot::RwLock; use std::sync::Arc; use tauri::AppHandle; -#[cfg(desktop)] use tauri::Manager; use crate::state::AppState; @@ -28,28 +27,32 @@ 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] @@ -74,16 +77,19 @@ 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()) + 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()) } else { Ok(false) } @@ -118,12 +124,6 @@ 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,12 +138,6 @@ 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())?; }