feat(app): add show_close for toggling close button in header bar

This commit is contained in:
Jeremy Soller 2024-08-26 09:35:41 -06:00 committed by Michael Murphy
parent 23bb4a122f
commit 00f0699042
2 changed files with 6 additions and 1 deletions

View file

@ -702,7 +702,6 @@ impl<App: Application> ApplicationExt for App {
.focused(focused)
.title(&core.window.header_title)
.on_drag(Message::Cosmic(cosmic::Message::Drag))
.on_close(Message::Cosmic(cosmic::Message::Close))
.on_right_click(Message::Cosmic(cosmic::Message::ShowWindowMenu))
.on_double_click(Message::Cosmic(cosmic::Message::Maximize));
@ -720,6 +719,10 @@ impl<App: Application> ApplicationExt for App {
header = header.start(toggle);
}
if core.window.show_close {
header = header.on_close(Message::Cosmic(cosmic::Message::Close));
}
if core.window.show_maximize && crate::config::show_maximize() {
header = header.on_maximize(Message::Cosmic(cosmic::Message::Maximize));
}