Current-terminal adapter for local terminal applications.
Ghostty.Terminal emulates a terminal and Ghostty.PTY manages child
pseudo-terminals. Ghostty.TTY is the complementary adapter for the terminal
running the current BEAM process: it starts raw input, decodes keyboard bytes
into Ghostty.KeyEvent, writes output, and reports resize events.
Events are sent to the owner process passed in :owner (defaults to the
process that calls start_link/1):
{Ghostty.TTY, tty, {:key, %Ghostty.KeyEvent{}}}
{Ghostty.TTY, tty, {:data, binary}}
{Ghostty.TTY, tty, {:resize, cols, rows}}
{Ghostty.TTY, tty, :eof}This module uses OTP terminal facilities rather than shelling out to stty.
Summary
Functions
Returns a child spec for supervision trees.
Types
@type event() :: {:key, Ghostty.KeyEvent.t()} | {:data, binary()} | {:resize, pos_integer(), pos_integer()} | :eof
@type option() :: {:owner, pid()} | {:name, GenServer.name()} | {:raw, boolean()}
Functions
Returns a child spec for supervision trees.
@spec size() :: {pos_integer(), pos_integer()}
@spec start_link([option()]) :: GenServer.on_start()
@spec write(GenServer.server(), iodata()) :: :ok