From eea37033bfe835167f6a1a499d7b9303ae4f0c92 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Sat, 1 Jul 2023 14:52:27 +0200 Subject: [PATCH] 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. --- macos/Sources/ContentView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macos/Sources/ContentView.swift b/macos/Sources/ContentView.swift index afe833a13..eb938cc2e 100644 --- a/macos/Sources/ContentView.swift +++ b/macos/Sources/ContentView.swift @@ -38,7 +38,7 @@ struct ContentView: View { .confirmationDialog( "Quit Ghostty?", isPresented: confirmQuitting) { - Button("Close Ghostty", role: .destructive) { + Button("Close Ghostty") { NSApplication.shared.reply(toApplicationShouldTerminate: true) } .keyboardShortcut(.defaultAction)