From 4d5de702f2613ea0130ec83eb7af867e51a9d8a0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 6 Mar 2026 12:33:06 -0800 Subject: [PATCH] macos: allow split command surface configuration --- macos/Ghostty.sdef | 3 +++ .../AppleScript/ScriptSplitCommand.swift | 20 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/macos/Ghostty.sdef b/macos/Ghostty.sdef index 7d0e219ce..c2e60dc80 100644 --- a/macos/Ghostty.sdef +++ b/macos/Ghostty.sdef @@ -149,6 +149,9 @@ + + + diff --git a/macos/Sources/Features/AppleScript/ScriptSplitCommand.swift b/macos/Sources/Features/AppleScript/ScriptSplitCommand.swift index 6e90eda50..e74eed78f 100644 --- a/macos/Sources/Features/AppleScript/ScriptSplitCommand.swift +++ b/macos/Sources/Features/AppleScript/ScriptSplitCommand.swift @@ -28,6 +28,19 @@ final class ScriptSplitCommand: NSScriptCommand { return nil } + let baseConfig: Ghostty.SurfaceConfiguration + do { + if let scriptRecord = evaluatedArguments?["configuration"] as? NSDictionary { + baseConfig = try Ghostty.SurfaceConfiguration(scriptRecord: scriptRecord) + } else { + baseConfig = Ghostty.SurfaceConfiguration() + } + } catch { + scriptErrorNumber = errAECoercionFail + scriptErrorString = error.localizedDescription + return nil + } + // Find the window controller that owns this surface. guard let controller = surfaceView.window?.windowController as? BaseTerminalController else { scriptErrorNumber = errAEEventFailed @@ -35,7 +48,11 @@ final class ScriptSplitCommand: NSScriptCommand { return nil } - guard let newView = controller.newSplit(at: surfaceView, direction: direction.splitDirection) else { + guard let newView = controller.newSplit( + at: surfaceView, + direction: direction.splitDirection, + baseConfig: baseConfig + ) else { scriptErrorNumber = errAEEventFailed scriptErrorString = "Failed to create split." return nil @@ -71,4 +88,3 @@ private enum ScriptSplitDirection { } } } -