diff --git a/macos/Sources/App/macOS/ghostty-bridging-header.h b/macos/Sources/App/macOS/ghostty-bridging-header.h index fc654ad3f..cf2061cd7 100644 --- a/macos/Sources/App/macOS/ghostty-bridging-header.h +++ b/macos/Sources/App/macOS/ghostty-bridging-header.h @@ -1,3 +1,12 @@ // C imports here are exposed to Swift. #import "VibrantLayer.h" + +// SDK version check for macOS 26 features +#import + +// Check if SDK version is macOS 26 or higher +// macOS 26.0 would be 260000 in the version macro +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 + #define SUPPORTS_MACOS_26_FEATURES 1 +#endif diff --git a/macos/Sources/Features/App Intents/CloseTerminalIntent.swift b/macos/Sources/Features/App Intents/CloseTerminalIntent.swift index 923d22c97..7dbee6136 100644 --- a/macos/Sources/Features/App Intents/CloseTerminalIntent.swift +++ b/macos/Sources/Features/App Intents/CloseTerminalIntent.swift @@ -12,8 +12,10 @@ struct CloseTerminalIntent: AppIntent { ) var terminal: TerminalEntity + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = .background + #endif @MainActor func perform() async throws -> some IntentResult { diff --git a/macos/Sources/Features/App Intents/CommandPaletteIntent.swift b/macos/Sources/Features/App Intents/CommandPaletteIntent.swift index fa983054b..8400985b4 100644 --- a/macos/Sources/Features/App Intents/CommandPaletteIntent.swift +++ b/macos/Sources/Features/App Intents/CommandPaletteIntent.swift @@ -19,8 +19,10 @@ struct CommandPaletteIntent: AppIntent { ) var command: CommandEntity + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = .background + #endif @MainActor func perform() async throws -> some IntentResult & ReturnsValue { diff --git a/macos/Sources/Features/App Intents/GetTerminalDetailsIntent.swift b/macos/Sources/Features/App Intents/GetTerminalDetailsIntent.swift index 1cbaa9d68..bb48c463b 100644 --- a/macos/Sources/Features/App Intents/GetTerminalDetailsIntent.swift +++ b/macos/Sources/Features/App Intents/GetTerminalDetailsIntent.swift @@ -17,8 +17,10 @@ struct GetTerminalDetailsIntent: AppIntent { ) var terminal: TerminalEntity + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = .background + #endif static var parameterSummary: some ParameterSummary { Summary("Get \(\.$detail) from \(\.$terminal)") diff --git a/macos/Sources/Features/App Intents/InputIntent.swift b/macos/Sources/Features/App Intents/InputIntent.swift index 17c97fbbb..799ff5c88 100644 --- a/macos/Sources/Features/App Intents/InputIntent.swift +++ b/macos/Sources/Features/App Intents/InputIntent.swift @@ -24,8 +24,10 @@ struct InputTextIntent: AppIntent { ) var terminal: TerminalEntity + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = [.background, .foreground] + #endif @MainActor func perform() async throws -> some IntentResult { @@ -74,8 +76,10 @@ struct KeyEventIntent: AppIntent { ) var terminal: TerminalEntity + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = [.background, .foreground] + #endif @MainActor func perform() async throws -> some IntentResult { @@ -136,8 +140,10 @@ struct MouseButtonIntent: AppIntent { ) var terminal: TerminalEntity + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = [.background, .foreground] + #endif @MainActor func perform() async throws -> some IntentResult { @@ -197,8 +203,10 @@ struct MousePosIntent: AppIntent { ) var terminal: TerminalEntity + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = [.background, .foreground] + #endif @MainActor func perform() async throws -> some IntentResult { @@ -265,8 +273,10 @@ struct MouseScrollIntent: AppIntent { ) var terminal: TerminalEntity + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = [.background, .foreground] + #endif @MainActor func perform() async throws -> some IntentResult { diff --git a/macos/Sources/Features/App Intents/KeybindIntent.swift b/macos/Sources/Features/App Intents/KeybindIntent.swift index b31da4a50..58f48daea 100644 --- a/macos/Sources/Features/App Intents/KeybindIntent.swift +++ b/macos/Sources/Features/App Intents/KeybindIntent.swift @@ -16,8 +16,10 @@ struct KeybindIntent: AppIntent { ) var action: String + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = [.background, .foreground] + #endif @MainActor func perform() async throws -> some IntentResult & ReturnsValue { diff --git a/macos/Sources/Features/App Intents/NewTerminalIntent.swift b/macos/Sources/Features/App Intents/NewTerminalIntent.swift index 9b95208bb..df280c2f7 100644 --- a/macos/Sources/Features/App Intents/NewTerminalIntent.swift +++ b/macos/Sources/Features/App Intents/NewTerminalIntent.swift @@ -43,8 +43,10 @@ struct NewTerminalIntent: AppIntent { ) var parent: TerminalEntity? + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = .foreground(.immediate) + #endif @available(macOS, obsoleted: 26.0, message: "Replaced by supportedModes") static var openAppWhenRun = true diff --git a/macos/Sources/Features/App Intents/QuickTerminalIntent.swift b/macos/Sources/Features/App Intents/QuickTerminalIntent.swift index 2e6c9850c..18287bbc3 100644 --- a/macos/Sources/Features/App Intents/QuickTerminalIntent.swift +++ b/macos/Sources/Features/App Intents/QuickTerminalIntent.swift @@ -5,8 +5,10 @@ struct QuickTerminalIntent: AppIntent { static var title: LocalizedStringResource = "Open the Quick Terminal" static var description = IntentDescription("Open the Quick Terminal. If it is already open, then do nothing.") + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) static var supportedModes: IntentModes = .background + #endif @MainActor func perform() async throws -> some IntentResult & ReturnsValue<[TerminalEntity]> { diff --git a/macos/Sources/Features/Terminal/Window Styles/TransparentTitlebarTerminalWindow.swift b/macos/Sources/Features/Terminal/Window Styles/TransparentTitlebarTerminalWindow.swift index f6ad6e56c..2d3bfc6fe 100644 --- a/macos/Sources/Features/Terminal/Window Styles/TransparentTitlebarTerminalWindow.swift +++ b/macos/Sources/Features/Terminal/Window Styles/TransparentTitlebarTerminalWindow.swift @@ -67,13 +67,14 @@ class TransparentTitlebarTerminalWindow: TerminalWindow { // references changed (e.g. tabGroup is new). setupKVO() - if #available(macOS 26.0, *) { - syncAppearanceTahoe(surfaceConfig) - } else { - syncAppearanceVentura(surfaceConfig) - } + #if SUPPORTS_MACOS_26_FEATURES + syncAppearanceTahoe(surfaceConfig) + #else + syncAppearanceVentura(surfaceConfig) + #endif } + #if SUPPORTS_MACOS_26_FEATURES @available(macOS 26.0, *) private func syncAppearanceTahoe(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) { // When we have transparency, we need to set the titlebar background to match the @@ -94,6 +95,7 @@ class TransparentTitlebarTerminalWindow: TerminalWindow { // that force a background color. titlebarBackgroundView?.isHidden = true } + #endif @available(macOS 13.0, *) private func syncAppearanceVentura(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {