macOS: change quit dialog to handle return by removing role

This is, as it turns out, the simple version of #166.

It changes the quit dialog to handle return by removing the
`.destructive` role from the `Quit` button.

When that role is set, the `keyboardShortcut(.defaultAction)` doesn't have an effect.

With the role removed, the dialog handles the return key to quit the
application

As I wrote in #166, I can understand if you don't want this change, but
I personally think it's nice to be able to only use the keyboard. iTerm2
also handles return like this in the "Are you sure?" dialog.
This commit is contained in:
Thorsten Ball
2023-07-01 14:52:27 +02:00
parent a212d811e7
commit eea37033bf

View File

@ -38,7 +38,7 @@ struct ContentView: View {
.confirmationDialog( .confirmationDialog(
"Quit Ghostty?", "Quit Ghostty?",
isPresented: confirmQuitting) { isPresented: confirmQuitting) {
Button("Close Ghostty", role: .destructive) { Button("Close Ghostty") {
NSApplication.shared.reply(toApplicationShouldTerminate: true) NSApplication.shared.reply(toApplicationShouldTerminate: true)
} }
.keyboardShortcut(.defaultAction) .keyboardShortcut(.defaultAction)