Files
ghostty/example
Mitchell Hashimoto d4ac93a039 terminal: add clipboard_set effect for OSC 52 clipboard writes (#13182)
libghostty-vt was already parsing OSC 52 into the clipboard_contents
action but the stream handler dropped, so there was no way to observe
clipboard writes (in this case, a program using go-libghostty). This
adds a clipboard_set effect following the existing bell/title_changed
pattern and expose it through the C API as
`GHOSTTY_TERMINAL_OPT_CLIPBOARD_SET`.

The callback receives the OSC 52 kind byte and the base64 payload
exactly as received; decoding and kind interpretation are left to the
embedder, matching how decoding is typically deferred.

Note this intentionally does not deal with clipboard read requests given
the security implications.

AI disclosure: Fable (via Claude Code) did the majority of the work
here, I validated it on the client side and fully understand the pattern
we're fitting into.
2026-07-10 09:27:21 -07:00
..
2026-03-28 18:34:15 -07:00
2026-03-17 17:13:08 -07:00
2026-03-17 17:37:20 -07:00

Examples

Standalone projects demonstrating the Ghostty library APIs. The directories starting with c- use the C API and the directories starting with zig- use the Zig API.

Every example can be built and run using zig build and zig build run from within the respective example directory. Even the C API examples use the Zig build system (not the language) to build the project.

Running an Example

cd example/<dir>
zig build run