fix: exit on close

This commit is contained in:
Ashley Wulber 2024-05-10 17:25:05 -04:00 committed by Michael Murphy
parent c877209f72
commit c4224ff36f
2 changed files with 12 additions and 1 deletions

View file

@ -525,6 +525,16 @@ impl cosmic::Application for SettingsApp {
.dialog(self.active_page)
.map(|e| e.map(Message::PageMessage))
}
fn on_close_requested(&self, id: window::Id) -> Option<Self::Message> {
if id == window::Id::MAIN {
std::thread::spawn(|| {
std::thread::sleep(tokio::time::Duration::from_millis(100));
std::process::exit(0);
});
}
None
}
}
impl SettingsApp {

View file

@ -116,7 +116,8 @@ pub fn main() -> color_eyre::Result<()> {
let args = Args::parse();
let settings = cosmic::app::Settings::default()
.size_limits(Limits::NONE.min_width(400.0).min_height(300.0));
.size_limits(Limits::NONE.min_width(400.0).min_height(300.0))
.exit_on_close(false);
cosmic::app::run_single_instance::<app::SettingsApp>(settings, args)?;