Skip to content

Instantly share code, notes, and snippets.

@LeoMartinDev
Created April 2, 2023 13:45
Show Gist options
  • Save LeoMartinDev/017ddd2e3e1266075b314bdc0fad4ddf to your computer and use it in GitHub Desktop.
Save LeoMartinDev/017ddd2e3e1266075b314bdc0fad4ddf to your computer and use it in GitHub Desktop.
Make Tauri app fullscreen
// 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