refactor: allow apps to request to be treated as a daemon
This commit is contained in:
parent
3cb4e4674e
commit
83910ff5b0
2 changed files with 6 additions and 1 deletions
|
|
@ -43,6 +43,9 @@ pub struct Settings {
|
|||
|
||||
/// If set to true the application will exit when the main window is closed.
|
||||
pub exit_on_close_request: bool,
|
||||
|
||||
/// Whether the application is a daemon
|
||||
pub is_daemon: bool,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
|
|
@ -55,6 +58,7 @@ impl Default for Settings {
|
|||
default_text_size: Pixels(14.0),
|
||||
antialiasing: false,
|
||||
exit_on_close_request: false,
|
||||
is_daemon: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,6 +69,7 @@ impl From<Settings> for iced_winit::Settings {
|
|||
iced_winit::Settings {
|
||||
id: settings.id,
|
||||
fonts: settings.fonts,
|
||||
is_daemon: settings.is_daemon,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ where
|
|||
};
|
||||
|
||||
let (program, task) = runtime.enter(|| program::Instance::new(program));
|
||||
let is_daemon = window_settings.is_none();
|
||||
let is_daemon = settings.is_daemon || window_settings.is_none();
|
||||
|
||||
let task = if let Some(window_settings) = window_settings {
|
||||
let mut task = Some(task);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue