mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 14:00:29 +00:00
macos: add AppleScript front window and focused terminal properties
This adds two new propeties to make it easy to get the frontmost (main) window and the focused terminal within a tab. We already had a property to get the selected tab of a tab group.
This commit is contained in:
@@ -57,6 +57,16 @@ extension NSApplication {
|
||||
return result
|
||||
}
|
||||
|
||||
/// Exposed as the AppleScript `front window` property.
|
||||
///
|
||||
/// `scriptWindows` is already ordered front-to-back, so the first item is
|
||||
/// the frontmost logical Ghostty window.
|
||||
@objc(frontWindow)
|
||||
var frontWindow: ScriptWindow? {
|
||||
guard isAppleScriptEnabled else { return nil }
|
||||
return scriptWindows.first
|
||||
}
|
||||
|
||||
/// Enables AppleScript unique-ID lookup for window references.
|
||||
///
|
||||
/// Required selector name pattern for element key `scriptWindows`:
|
||||
|
||||
Reference in New Issue
Block a user