pub struct AppConfig {
pub windows: Vec<WindowConfig>,
pub security: SecurityConfig,
pub tray_icon: Option<TrayIconConfig>,
pub macos_private_api: bool,
pub with_global_tauri: bool,
pub enable_gtk_app_id: bool,
}Expand description
The App configuration object.
Fields§
§windows: Vec<WindowConfig>The app windows configuration.
§Example:
To create a window at app startup
{
"app": {
"windows": [
{ "width": 800, "height": 600 }
]
}
}If not specified, the window’s label (its identifier) defaults to “main”,
you can use this label to get the window through
app.get_webview_window in Rust or WebviewWindow.getByLabel in JavaScript
When working with multiple windows, each window will need an unique label
{
"app": {
"windows": [
{ "label": "main", "width": 800, "height": 600 },
{ "label": "secondary", "width": 800, "height": 600 }
]
}
}You can also set create to false and use this config through the Rust APIs
{
"app": {
"windows": [
{ "create": false, "width": 800, "height": 600 }
]
}
}and use it like this
tauri::Builder::default()
.setup(|app| {
tauri::WebviewWindowBuilder::from_config(app.handle(), app.config().app.windows[0])?.build()?;
Ok(())
});security: SecurityConfigSecurity configuration.
tray_icon: Option<TrayIconConfig>Configuration for app tray icon.
macos_private_api: boolMacOS private API configuration. Enables the transparent background API and sets the fullScreenEnabled preference to true.
with_global_tauri: boolWhether we should inject the Tauri API on window.__TAURI__ or not.
enable_gtk_app_id: boolIf set to true “identifier” will be set as GTK app ID (on systems that use GTK).