Files
ghostty/macos/Ghostty.sdef
Mitchell Hashimoto ef669eeae7 macos: add AppleScript split command
Add a new `split` command to the AppleScript scripting dictionary that
splits a terminal in a given direction (right, left, down, up) and
returns the newly created terminal.

The command is exposed as:
  split terminal <terminal> direction <direction>

Also adds a `fourCharCode` String extension for converting four-character
ASCII strings to their FourCharCode (UInt32) representation.
2026-03-05 20:54:34 -08:00

66 lines
3.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary title="Ghostty Scripting Dictionary">
<suite name="Ghostty Suite" code="Ghst" description="Ghostty scripting support.">
<class name="application" code="capp" description="The Ghostty application.">
<cocoa class="NSApplication"/>
<responds-to command="perform action">
<cocoa method="handlePerformActionScriptCommand:"/>
</responds-to>
<element type="terminal" access="r">
<cocoa key="terminals"/>
</element>
</class>
<class name="terminal" code="Gtrm" plural="terminals" description="An individual terminal surface.">
<cocoa class="GhosttyScriptTerminal"/>
<property name="id" code="ID " type="text" access="r" description="Stable ID for this terminal surface."/>
<property name="title" code="Gttl" type="text" access="r" description="Current terminal title."/>
<property name="working directory" code="Gwdr" type="text" access="r" description="Current working directory for the terminal process."/>
</class>
<command name="perform action" code="GhstPfAc" description="Perform a Ghostty action string on a terminal.">
<direct-parameter type="text" description="The Ghostty action string."/>
<parameter name="on" code="GonT" type="terminal" description="Target terminal."/>
<result type="boolean" description="True when the action was performed."/>
</command>
<enumeration name="split direction" code="GSpD" description="Direction for a new split.">
<enumerator name="right" code="GSrt" description="Split to the right."/>
<enumerator name="left" code="GSlf" description="Split to the left."/>
<enumerator name="down" code="GSdn" description="Split downward."/>
<enumerator name="up" code="GSup" description="Split upward."/>
</enumeration>
<command name="split" code="GhstSplt" description="Split a terminal in the given direction.">
<cocoa class="GhosttyScriptSplitCommand"/>
<parameter name="terminal" code="GSpT" type="terminal" description="The terminal to split.">
<cocoa key="terminal"/>
</parameter>
<parameter name="direction" code="GSpd" type="split direction" description="The direction to split.">
<cocoa key="direction"/>
</parameter>
<result type="terminal" description="The newly created terminal."/>
</command>
</suite>
<!--
The Standard Suite definition below is copied from Apple's
/System/Library/ScriptingDefinitions/CocoaStandard.sdef, trimmed to only
include what we need.
-->
<suite name="Standard Suite" code="????" description="Common classes and commands for all applications.">
<command name="count" code="corecnte" description="Return the number of elements of a particular class within an object.">
<cocoa class="NSCountCommand"/>
<access-group identifier="*"/>
<direct-parameter type="specifier" requires-access="r" description="The objects to be counted."/>
<parameter name="each" code="kocl" type="type" optional="yes" description="The class of objects to be counted." hidden="yes">
<cocoa key="ObjectClass"/>
</parameter>
<result type="integer" description="The count."/>
</command>
</suite>
</dictionary>