mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 05:50:27 +00:00
macos: expose name (title) on window, tab, and terminal via AppleScript
Add a `name` property (code `pnam`, cocoa key `title`) to the window, tab, and terminal classes in the scripting definition. This follows the standard Cocoa scripting convention where `name`/`pnam` maps to the `title` KVC key, matching what Apple does in CocoaStandard.sdef for NSWindow. Also fixes the pre-existing terminal `title` property which used a custom four-char code (`Gttl`) that AppleScript could not resolve directly — only via `properties of terminal`. All three classes now use the standard `pnam` code so `name of window 1`, `name of tab 1 of window 1`, and `name of terminal 1` all work correctly.
This commit is contained in:
@@ -37,6 +37,14 @@ final class ScriptTab: NSObject {
|
||||
stableID
|
||||
}
|
||||
|
||||
/// Exposed as the AppleScript `title` property.
|
||||
///
|
||||
/// Returns the title of the tab's window.
|
||||
@objc(title)
|
||||
var title: String {
|
||||
controller?.window?.title ?? ""
|
||||
}
|
||||
|
||||
/// Exposed as the AppleScript `index` property.
|
||||
///
|
||||
/// Cocoa scripting expects this to be 1-based for user-facing collections.
|
||||
|
||||
Reference in New Issue
Block a user