Created
April 2, 2023 13:45
-
-
Save LeoMartinDev/017ddd2e3e1266075b314bdc0fad4ddf to your computer and use it in GitHub Desktop.
Make Tauri app fullscreen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | |
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | |
use tauri::Manager; | |
fn main() { | |
tauri::Builder::default() | |
.setup(|app| { | |
let main_window = app.get_window("main").unwrap(); | |
main_window | |
.hide() | |
.and_then(|_| main_window.current_monitor()) | |
.unwrap_or(None) | |
.map(|monitor| monitor.size().clone()) | |
.map(|size| main_window.set_size(size)) | |
.map(|_| main_window.center()) | |
.map(|_| main_window.show()); | |
Ok(()) | |
}) | |
.run(tauri::generate_context!()) | |
.expect("error while running tauri application"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment