mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-06 07:38:21 +00:00
macos: order AppleScript dictionary definitions
Document the preferred Ghostty.sdef top-level order in AGENTS.md and reorder Ghostty Suite definitions to classes, records, enums, then commands.
This commit is contained in:
@@ -13,6 +13,11 @@
|
||||
## AppleScript
|
||||
|
||||
- The AppleScript scripting definition is in `macos/Ghostty.sdef`.
|
||||
- In `macos/Ghostty.sdef`, keep top-level definitions in this order:
|
||||
1. Classes
|
||||
2. Records
|
||||
3. Enums
|
||||
4. Commands
|
||||
- Test AppleScript support:
|
||||
(1) Build with `macos/build.nu`
|
||||
(2) Launch and activate the app via osascript using the absolute path
|
||||
|
||||
@@ -32,28 +32,6 @@
|
||||
</element>
|
||||
</class>
|
||||
|
||||
<record-type name="surface configuration" code="GScf" description="Reusable settings applied when creating a terminal surface.">
|
||||
<property name="font size" code="GScF" type="real" description="Font size in points.">
|
||||
<cocoa key="fontSize"/>
|
||||
</property>
|
||||
<property name="working directory" code="GScD" type="text" description="Working directory for the terminal process.">
|
||||
<cocoa key="workingDirectory"/>
|
||||
</property>
|
||||
<property name="command" code="GScC" type="text" description="Command to execute instead of the configured shell.">
|
||||
<cocoa key="command"/>
|
||||
</property>
|
||||
<property name="initial input" code="GScI" type="text" description="Input sent to the terminal after launch.">
|
||||
<cocoa key="initialInput"/>
|
||||
</property>
|
||||
<property name="wait after command" code="GScW" type="boolean" description="Keep the terminal open after command exit.">
|
||||
<cocoa key="waitAfterCommand"/>
|
||||
</property>
|
||||
<property name="environment variables" code="GScE" description="Environment variables in KEY=VALUE format.">
|
||||
<type type="text" list="yes"/>
|
||||
<cocoa key="environmentVariables"/>
|
||||
</property>
|
||||
</record-type>
|
||||
|
||||
<class name="window" code="Gwnd" plural="windows" description="A Ghostty window containing one or more tabs.">
|
||||
<cocoa class="GhosttyScriptWindow"/>
|
||||
<property name="id" code="ID " type="text" access="r" description="Stable ID for this window."/>
|
||||
@@ -93,6 +71,56 @@
|
||||
<property name="working directory" code="Gwdr" type="text" access="r" description="Current working directory for the terminal process."/>
|
||||
</class>
|
||||
|
||||
<record-type name="surface configuration" code="GScf" description="Reusable settings applied when creating a terminal surface.">
|
||||
<property name="font size" code="GScF" type="real" description="Font size in points.">
|
||||
<cocoa key="fontSize"/>
|
||||
</property>
|
||||
<property name="working directory" code="GScD" type="text" description="Working directory for the terminal process.">
|
||||
<cocoa key="workingDirectory"/>
|
||||
</property>
|
||||
<property name="command" code="GScC" type="text" description="Command to execute instead of the configured shell.">
|
||||
<cocoa key="command"/>
|
||||
</property>
|
||||
<property name="initial input" code="GScI" type="text" description="Input sent to the terminal after launch.">
|
||||
<cocoa key="initialInput"/>
|
||||
</property>
|
||||
<property name="wait after command" code="GScW" type="boolean" description="Keep the terminal open after command exit.">
|
||||
<cocoa key="waitAfterCommand"/>
|
||||
</property>
|
||||
<property name="environment variables" code="GScE" description="Environment variables in KEY=VALUE format.">
|
||||
<type type="text" list="yes"/>
|
||||
<cocoa key="environmentVariables"/>
|
||||
</property>
|
||||
</record-type>
|
||||
|
||||
<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>
|
||||
|
||||
<enumeration name="input action" code="GIAc" description="Whether an input is pressed or released.">
|
||||
<enumerator name="press" code="GIpr" description="Press."/>
|
||||
<enumerator name="release" code="GIrl" description="Release."/>
|
||||
</enumeration>
|
||||
|
||||
<enumeration name="mouse button" code="GMBt" description="A mouse button.">
|
||||
<enumerator name="left button" code="GMlf" description="Left mouse button."/>
|
||||
<enumerator name="right button" code="GMrt" description="Right mouse button."/>
|
||||
<enumerator name="middle button" code="GMmd" description="Middle mouse button."/>
|
||||
</enumeration>
|
||||
|
||||
<enumeration name="scroll momentum" code="GSMo" description="Momentum phase for inertial scrolling.">
|
||||
<enumerator name="none" code="SMno" description="No momentum."/>
|
||||
<enumerator name="began" code="SMbg" description="Momentum began."/>
|
||||
<enumerator name="changed" code="SMch" description="Momentum changed."/>
|
||||
<enumerator name="ended" code="SMen" description="Momentum ended."/>
|
||||
<enumerator name="cancelled" code="SMcn" description="Momentum cancelled."/>
|
||||
<enumerator name="may begin" code="SMmb" description="Momentum may begin."/>
|
||||
<enumerator name="stationary" code="SMst" description="Stationary."/>
|
||||
</enumeration>
|
||||
|
||||
<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."/>
|
||||
@@ -113,13 +141,6 @@
|
||||
<result type="window" description="The newly created window."/>
|
||||
</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.">
|
||||
@@ -153,11 +174,6 @@
|
||||
</parameter>
|
||||
</command>
|
||||
|
||||
<enumeration name="input action" code="GIAc" description="Whether an input is pressed or released.">
|
||||
<enumerator name="press" code="GIpr" description="Press."/>
|
||||
<enumerator name="release" code="GIrl" description="Release."/>
|
||||
</enumeration>
|
||||
|
||||
<command name="send key" code="GhstSKey" description="Send a keyboard event to a terminal.">
|
||||
<cocoa class="GhosttyScriptKeyEventCommand"/>
|
||||
<direct-parameter type="text" description="The key name (e.g. "enter", "a", "space")."/>
|
||||
@@ -172,12 +188,6 @@
|
||||
</parameter>
|
||||
</command>
|
||||
|
||||
<enumeration name="mouse button" code="GMBt" description="A mouse button.">
|
||||
<enumerator name="left button" code="GMlf" description="Left mouse button."/>
|
||||
<enumerator name="right button" code="GMrt" description="Right mouse button."/>
|
||||
<enumerator name="middle button" code="GMmd" description="Middle mouse button."/>
|
||||
</enumeration>
|
||||
|
||||
<command name="send mouse button" code="GhstSMBt" description="Send a mouse button event to a terminal.">
|
||||
<cocoa class="GhosttyScriptMouseButtonCommand"/>
|
||||
<direct-parameter type="mouse button" description="The mouse button."/>
|
||||
@@ -208,16 +218,6 @@
|
||||
</parameter>
|
||||
</command>
|
||||
|
||||
<enumeration name="scroll momentum" code="GSMo" description="Momentum phase for inertial scrolling.">
|
||||
<enumerator name="none" code="SMno" description="No momentum."/>
|
||||
<enumerator name="began" code="SMbg" description="Momentum began."/>
|
||||
<enumerator name="changed" code="SMch" description="Momentum changed."/>
|
||||
<enumerator name="ended" code="SMen" description="Momentum ended."/>
|
||||
<enumerator name="cancelled" code="SMcn" description="Momentum cancelled."/>
|
||||
<enumerator name="may begin" code="SMmb" description="Momentum may begin."/>
|
||||
<enumerator name="stationary" code="SMst" description="Stationary."/>
|
||||
</enumeration>
|
||||
|
||||
<command name="send mouse scroll" code="GhstSMSc" description="Send a mouse scroll event to a terminal.">
|
||||
<cocoa class="GhosttyScriptMouseScrollCommand"/>
|
||||
<parameter name="x" code="GMsX" type="real" description="Horizontal scroll delta.">
|
||||
|
||||
@@ -145,7 +145,9 @@
|
||||
Features/AppleScript/ScriptMouseButtonCommand.swift,
|
||||
Features/AppleScript/ScriptMousePosCommand.swift,
|
||||
Features/AppleScript/ScriptMouseScrollCommand.swift,
|
||||
Features/AppleScript/ScriptRecord.swift,
|
||||
Features/AppleScript/ScriptSplitCommand.swift,
|
||||
Features/AppleScript/ScriptSurfaceConfiguration.swift,
|
||||
Features/AppleScript/ScriptTab.swift,
|
||||
Features/AppleScript/ScriptTerminal.swift,
|
||||
Features/AppleScript/ScriptWindow.swift,
|
||||
|
||||
Reference in New Issue
Block a user