fix: exit on close
This commit is contained in:
parent
c877209f72
commit
c4224ff36f
2 changed files with 12 additions and 1 deletions
|
|
@ -525,6 +525,16 @@ impl cosmic::Application for SettingsApp {
|
||||||
.dialog(self.active_page)
|
.dialog(self.active_page)
|
||||||
.map(|e| e.map(Message::PageMessage))
|
.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 {
|
impl SettingsApp {
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,8 @@ pub fn main() -> color_eyre::Result<()> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
let settings = cosmic::app::Settings::default()
|
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)?;
|
cosmic::app::run_single_instance::<app::SettingsApp>(settings, args)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue