Files
ghostty/macos/AGENTS.md
Mitchell Hashimoto 1742aeda50 macos: add focus and close AppleScript commands for terminals
Add two new AppleScript commands to the scripting dictionary:

- `focus terminal <terminal>` — focuses the given terminal and brings
  its window to the front.
- `close terminal <terminal>` — closes the given terminal without a
  confirmation prompt.

Each command is implemented as an NSScriptCommand subclass following
the same pattern as the existing split command.
2026-03-05 20:59:03 -08:00

1.3 KiB

macOS Ghostty Application

  • Use swiftlint for formatting and linting Swift code.
  • If code outside of macos/ directory is modified, use zig build -Demit-macos-app=false before building the macOS app to update the underlying Ghostty library.
  • Use macos/build.nu to build the macOS app, do not use zig build (except to build the underlying library as mentioned above).
    • Build: macos/build.nu [--scheme Ghostty] [--configuration Debug] [--action build]
    • Output: macos/build/<configuration>/Ghostty.app (e.g. macos/build/Debug/Ghostty.app)
  • Run unit tests directly with macos/build.nu --action test

AppleScript

  • The AppleScript scripting definition is in macos/Ghostty.sdef.
  • Test AppleScript support: (1) Build with macos/build.nu (2) Launch and activate the app via osascript using the absolute path to the built app bundle: osascript -e 'tell application "<absolute path to build/Debug/Ghostty.app>" to activate' (3) Wait a few seconds for the app to fully launch and open a terminal. (4) Run test scripts with osascript, always targeting the app by its absolute path (not by name) to avoid calling the wrong application. (5) When done, quit via: osascript -e 'tell application "<absolute path to build/Debug/Ghostty.app>" to quit'