mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-25 13:16:11 +03:00
build: fix macOS 26 SDK compatibility for App Intents
Add compile-time SDK version checking to conditionally compile macOS 26 features, allowing the project to build on macOS 15. - Add SUPPORTS_MACOS_26_FEATURES macro in bridging header - Wrap App Intents supportedModes properties with conditional compilation - Fix TransparentTitlebarTerminalWindow method calls
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
// C imports here are exposed to Swift.
|
// C imports here are exposed to Swift.
|
||||||
|
|
||||||
#import "VibrantLayer.h"
|
#import "VibrantLayer.h"
|
||||||
|
|
||||||
|
// SDK version check for macOS 26 features
|
||||||
|
#import <AvailabilityMacros.h>
|
||||||
|
|
||||||
|
// 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
|
||||||
|
@ -12,8 +12,10 @@ struct CloseTerminalIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var terminal: TerminalEntity
|
var terminal: TerminalEntity
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = .background
|
static var supportedModes: IntentModes = .background
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult {
|
||||||
|
@ -19,8 +19,10 @@ struct CommandPaletteIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var command: CommandEntity
|
var command: CommandEntity
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = .background
|
static var supportedModes: IntentModes = .background
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
|
func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
|
||||||
|
@ -17,8 +17,10 @@ struct GetTerminalDetailsIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var terminal: TerminalEntity
|
var terminal: TerminalEntity
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = .background
|
static var supportedModes: IntentModes = .background
|
||||||
|
#endif
|
||||||
|
|
||||||
static var parameterSummary: some ParameterSummary {
|
static var parameterSummary: some ParameterSummary {
|
||||||
Summary("Get \(\.$detail) from \(\.$terminal)")
|
Summary("Get \(\.$detail) from \(\.$terminal)")
|
||||||
|
@ -24,8 +24,10 @@ struct InputTextIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var terminal: TerminalEntity
|
var terminal: TerminalEntity
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = [.background, .foreground]
|
static var supportedModes: IntentModes = [.background, .foreground]
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult {
|
||||||
@ -74,8 +76,10 @@ struct KeyEventIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var terminal: TerminalEntity
|
var terminal: TerminalEntity
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = [.background, .foreground]
|
static var supportedModes: IntentModes = [.background, .foreground]
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult {
|
||||||
@ -136,8 +140,10 @@ struct MouseButtonIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var terminal: TerminalEntity
|
var terminal: TerminalEntity
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = [.background, .foreground]
|
static var supportedModes: IntentModes = [.background, .foreground]
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult {
|
||||||
@ -197,8 +203,10 @@ struct MousePosIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var terminal: TerminalEntity
|
var terminal: TerminalEntity
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = [.background, .foreground]
|
static var supportedModes: IntentModes = [.background, .foreground]
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult {
|
||||||
@ -265,8 +273,10 @@ struct MouseScrollIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var terminal: TerminalEntity
|
var terminal: TerminalEntity
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = [.background, .foreground]
|
static var supportedModes: IntentModes = [.background, .foreground]
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult {
|
||||||
|
@ -16,8 +16,10 @@ struct KeybindIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var action: String
|
var action: String
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = [.background, .foreground]
|
static var supportedModes: IntentModes = [.background, .foreground]
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
|
func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
|
||||||
|
@ -43,8 +43,10 @@ struct NewTerminalIntent: AppIntent {
|
|||||||
)
|
)
|
||||||
var parent: TerminalEntity?
|
var parent: TerminalEntity?
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = .foreground(.immediate)
|
static var supportedModes: IntentModes = .foreground(.immediate)
|
||||||
|
#endif
|
||||||
|
|
||||||
@available(macOS, obsoleted: 26.0, message: "Replaced by supportedModes")
|
@available(macOS, obsoleted: 26.0, message: "Replaced by supportedModes")
|
||||||
static var openAppWhenRun = true
|
static var openAppWhenRun = true
|
||||||
|
@ -5,8 +5,10 @@ struct QuickTerminalIntent: AppIntent {
|
|||||||
static var title: LocalizedStringResource = "Open the Quick Terminal"
|
static var title: LocalizedStringResource = "Open the Quick Terminal"
|
||||||
static var description = IntentDescription("Open the Quick Terminal. If it is already open, then do nothing.")
|
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, *)
|
@available(macOS 26.0, *)
|
||||||
static var supportedModes: IntentModes = .background
|
static var supportedModes: IntentModes = .background
|
||||||
|
#endif
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func perform() async throws -> some IntentResult & ReturnsValue<[TerminalEntity]> {
|
func perform() async throws -> some IntentResult & ReturnsValue<[TerminalEntity]> {
|
||||||
|
@ -67,13 +67,14 @@ class TransparentTitlebarTerminalWindow: TerminalWindow {
|
|||||||
// references changed (e.g. tabGroup is new).
|
// references changed (e.g. tabGroup is new).
|
||||||
setupKVO()
|
setupKVO()
|
||||||
|
|
||||||
if #available(macOS 26.0, *) {
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
syncAppearanceTahoe(surfaceConfig)
|
syncAppearanceTahoe(surfaceConfig)
|
||||||
} else {
|
#else
|
||||||
syncAppearanceVentura(surfaceConfig)
|
syncAppearanceVentura(surfaceConfig)
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SUPPORTS_MACOS_26_FEATURES
|
||||||
@available(macOS 26.0, *)
|
@available(macOS 26.0, *)
|
||||||
private func syncAppearanceTahoe(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
|
private func syncAppearanceTahoe(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
|
||||||
// When we have transparency, we need to set the titlebar background to match the
|
// 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.
|
// that force a background color.
|
||||||
titlebarBackgroundView?.isHidden = true
|
titlebarBackgroundView?.isHidden = true
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
@available(macOS 13.0, *)
|
@available(macOS 13.0, *)
|
||||||
private func syncAppearanceVentura(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
|
private func syncAppearanceVentura(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
|
||||||
|
Reference in New Issue
Block a user