mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 03:25:50 +00:00
macos: Add AppleScript commands for window and tab control
Add scripting dictionary commands for activating windows, selecting tabs, closing tabs, and closing windows. Implement the corresponding Cocoa AppleScript command handlers and expose minimal ScriptWindow/ScriptTab helpers needed to resolve live targets. Verified by building Ghostty and running osascript commands against the absolute Debug app path to exercise all four new commands.
This commit is contained in:
@@ -116,6 +116,11 @@ final class ScriptWindow: NSObject {
|
||||
selectedController?.window ?? controllers.first?.window
|
||||
}
|
||||
|
||||
/// Best-effort controller to use for window-scoped AppleScript commands.
|
||||
var preferredController: BaseTerminalController? {
|
||||
selectedController ?? controllers.first
|
||||
}
|
||||
|
||||
/// Resolves a previously generated tab ID back to a live controller.
|
||||
private func controller(tabID: String) -> BaseTerminalController? {
|
||||
controllers.first(where: { ScriptTab.stableID(controller: $0) == tabID })
|
||||
|
||||
Reference in New Issue
Block a user