diff --git a/macos/Sources/GhosttyApp.swift b/macos/Sources/GhosttyApp.swift index 42997a606..3588f6031 100644 --- a/macos/Sources/GhosttyApp.swift +++ b/macos/Sources/GhosttyApp.swift @@ -11,6 +11,7 @@ struct GhosttyApp: App { /// The ghostty global state. Only one per process. @StateObject private var ghostty = GhosttyState() + @NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate; var body: some Scene { WindowGroup { @@ -45,6 +46,15 @@ struct GhosttyApp: App { } } +class AppDelegate: NSObject, NSApplicationDelegate { + func applicationDidFinishLaunching(_ notification: Notification) { + UserDefaults.standard.register(defaults: [ + // Disable this so that repeated key events make it through to our terminal views. + "ApplePressAndHoldEnabled": false, + ]) + } +} + class GhosttyState: ObservableObject { enum Readiness { case loading, error, ready