dioxus_native/
config.rs

1use dioxus_core::LaunchConfig;
2use winit::window::WindowAttributes;
3
4/// The configuration for the desktop application.
5pub struct Config {
6    pub(crate) window_attributes: WindowAttributes,
7}
8
9impl LaunchConfig for Config {}
10
11impl Default for Config {
12    fn default() -> Self {
13        Self {
14            window_attributes: WindowAttributes::default().with_title(
15                dioxus_cli_config::app_title().unwrap_or_else(|| "Dioxus App".to_string()),
16            ),
17        }
18    }
19}
20
21impl Config {
22    pub fn new() -> Self {
23        Self::default()
24    }
25
26    /// Set the configuration for the window.
27    pub fn with_window_attributes(mut self, attrs: WindowAttributes) -> Self {
28        // We need to do a swap because the window builder only takes itself as muy self
29        self.window_attributes = attrs;
30        self
31    }
32}