fix: enable AppleScript by always returning true for isAppleScriptEnabled

The underlying Ghostty fork does not include the `macos-applescript`
config key (added in upstream ghostty commit 25fa58143, 2026-03-06).
As a result, `appleScriptAutomationEnabled()` always returns false,
causing `scriptWindows` to return an empty array.

This makes `count windows`, `every window`, `front window`, and all
AppleScript window/tab/terminal access silently return empty results.

Fix: always return true from `isAppleScriptEnabled` until the fork
is updated with the upstream config key.

Test results (before fix):
  osascript -e 'tell application "cmux" to count windows'  →  0
  osascript -e 'tell application "cmux" to get version'    →  0.62.2

Test results (after fix):
  osascript -e 'tell application "cmux DEV ..." to count windows'  →  1
  osascript -e 'tell application "cmux DEV ..." to count terminals of tab 1 of window 1'  →  works
  osascript -e 'tell application "cmux DEV ..." to input text "..." to terminal 1 of ...'  →  works

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Grimmer Kang 2026-03-20 04:01:58 +08:00
parent 8d4ba242ad
commit cf5162ff4a

View file

@ -81,7 +81,13 @@ private extension Workspace {
@MainActor
extension NSApplication {
var isAppleScriptEnabled: Bool {
GhosttyApp.shared.appleScriptAutomationEnabled()
// cmux always enables AppleScript the underlying Ghostty fork
// doesn't have the macos-applescript config key yet (added in
// upstream ghostty commit 25fa58143, 2026-03-06), so
// appleScriptAutomationEnabled() always returns false.
// Once the fork is updated, this can revert to:
// GhosttyApp.shared.appleScriptAutomationEnabled()
return true
}
@discardableResult