Commit Graph

297 Commits

Author SHA1 Message Date
Mitchell Hashimoto
943d3d2e89 vt: add setopt_from_terminal to C API
Expose the key encoder Options.fromTerminal function to the C API as
ghostty_key_encoder_setopt_from_terminal. This lets C callers sync all
terminal-derived encoding options (cursor key application mode, keypad
mode, alt escape prefix, modifyOtherKeys, and Kitty flags) in a single
call instead of setting each option individually.
2026-03-15 07:05:07 -07:00
Mitchell Hashimoto
f730eed213 vt: fix missing formatter docs in doxygen 2026-03-14 15:42:00 -07:00
Mitchell Hashimoto
1e21ac1190 example: add c-vt-formatter example
Add an example showing how to use the ghostty-vt terminal and
formatter APIs from C. The example creates a terminal, writes
VT-encoded content with cursor movement and styling sequences,
then formats the screen contents as plain text using the formatter
API.
2026-03-14 15:12:10 -07:00
Mitchell Hashimoto
3c8feda118 vt: add format_alloc to C API formatter
Rename the existing format function to format_buf to clarify that it
writes into a caller-provided buffer. Add a new format_alloc variant
that allocates the output buffer internally using the provided
allocator (or the default if NULL). The caller receives the allocated
pointer and length and is responsible for freeing it.

This is useful for consumers that do not know the required buffer size
ahead of time and want to avoid the two-pass query-then-format pattern
needed with format_buf.
2026-03-14 14:59:41 -07:00
Mitchell Hashimoto
a2d570b51e vt: add sized struct pattern and types.h
Add a size field as the first member of formatter option structs
(TerminalOptions, TerminalOptions.Extra, ScreenOptions.Extra) for ABI
compatibility. This allows adding new fields without breaking callers
compiled against older versions of the struct.

Introduce include/ghostty/vt/types.h as the foundational header
containing GhosttyResult and the GHOSTTY_INIT_SIZED macro for
zero-initializing sized structs. Remove the separate result.h header,
moving its contents into types.h.
2026-03-14 14:42:50 -07:00
Mitchell Hashimoto
09d3ebd80d vt: use explicit options structs 2026-03-14 14:30:36 -07:00
Mitchell Hashimoto
b5fb7ecaaa vt: wip formatter api 2026-03-14 14:16:44 -07:00
Mitchell Hashimoto
34acdfcc4e vt: update terminal.h docs 2026-03-13 19:59:09 -07:00
Mitchell Hashimoto
aa3e6e23a2 vt: ghostty_terminal_reset 2026-03-13 19:55:43 -07:00
Mitchell Hashimoto
fe6e7fbc6b vt: ghostty_terminal_resize 2026-03-13 19:54:20 -07:00
Mitchell Hashimoto
8b9afe35a7 vt: ghostty_terminal_scroll_viewport 2026-03-13 19:51:04 -07:00
Mitchell Hashimoto
18fdc15357 vt: ghostty_terminal_vt_write 2026-03-13 19:37:26 -07:00
Mitchell Hashimoto
302e68fd3d vt: expose ghostty_terminal_new/free 2026-03-13 14:10:57 -07:00
Mitchell Hashimoto
86c2a2e87f input: add direct set_surface_title and set_tab_title actions
Fixes #11316

This mirrors the `prompt` actions (hence why there is no window action
here) and enables setting titles via keybind actions which importantly
lets this work via command palettes, App Intents, AppleScript, etc.
2026-03-11 09:25:08 -07:00
Mitchell Hashimoto
aaad43c235 macos: make paste_from_clipboard performable on macos
Fixes #10751
2026-03-10 10:25:14 -07:00
Mitchell Hashimoto
a384af5e25 vt: align SGR C enum tags with parser output
Remove the stale GHOSTTY_SGR_ATTR_RESET_UNDERLINE entry from the C header
and renumber subsequent GhosttySgrAttributeTag values to match
src/terminal/sgr.zig Attribute.Tag ordering.

This fixes misclassified attributes from ghostty_sgr_next for C consumers
that switch on the enum tags from include/ghostty/vt/sgr.h.
2026-03-08 12:54:46 -07:00
Mitchell Hashimoto
98ad1d955c use proper type for optional path 2026-03-03 19:53:15 -08:00
Jeffrey C. Ollie
cdf0dd15e9 testing: use std.Build.TranslateC instead of @cImport 2026-02-27 10:13:03 -06:00
Jeffrey C. Ollie
ea5b07d20f core: add tests for ghostty.h
* ensure that `ghostty.h` compiles during basic Zig tests
* ensure that non-exhaustive enums are kept synchronized between
  `ghostty.h` and their respective Zig counterpart.
* adjust some enums that varied from established conventions
2026-02-27 09:22:23 -06:00
Jeffrey C. Ollie
b30db91e69 build: test that ghostty.h compiles during a normal zig build test 2026-02-27 09:22:22 -06:00
benodiwal
3d0da44e15 feat(config): allow fullscreen config to specify non-native mode directly
Co-Authored-By: Sachin <sachinbeniwal0101@gmail.com>
2026-02-19 14:34:22 -08:00
Priyanshu
de49b7f27b rename copy_title action to copy_title_to_clipboard 2026-02-13 09:59:02 +05:30
Priyanshu
b4be13ed50 fix: copy_title_to_clipboard now respects user-overridden title
When a user renames a surface via "Change Terminal Title" and then
uses copy_title_to_clipboard, the raw terminal title was copied
instead of the custom name.

This adds a new `copy_title` apprt action so each platform resolves
the effective title (user override or terminal-set) before copying
to clipboard.

Fixes #10345
2026-02-13 01:19:15 +05:30
Mitchell Hashimoto
3f006f86a3 lib-vt: fix up the OSC command keys 2026-01-23 14:42:05 -08:00
Lars
9c5d4a5511 ghosttyKit: add ghostty_config_load_file 2026-01-20 09:15:14 -08:00
Tim Culverhouse
5ee56409c7 macos: support mouse buttons 8/9 (back/forward)
Add support for mouse buttons 4-11 in the macOS app. Previously only
left, right, and middle buttons were handled. Now otherMouseDown/Up
events properly map NSEvent.buttonNumber to the corresponding Ghostty
mouse button, enabling back/forward button support.

Fixes: https://github.com/ghostty-org/ghostty/issues/2425
Amp-Thread-ID: https://ampcode.com/threads/T-019bd74e-6b2b-731d-b43a-ac73b3460c32
Co-authored-by: Amp <amp@ampcode.com>
2026-01-19 11:59:50 -06:00
Mitchell Hashimoto
856ef1fc1b input: change the key_is_binding to return some information 2026-01-09 06:51:48 -08:00
Leah Amelia Chen
c559a1dbba Allow for default or inherited CWD in new window, tab and split surfaces (redone for GTK-NG) (#9158) 2026-01-07 20:45:06 +08:00
Mitchell Hashimoto
8e28f58b42 rename the selection search binding, unify into start_search action 2026-01-06 14:10:42 -08:00
Aaron Ruan
9b6a3be993 macOS: Selection for Find feature
Adds the `selection_for_search` action, with Cmd+E keybind by default.
This action inputs the currently selected text into the search
field without changing focus, matching standard macOS behavior.
2026-01-06 22:21:55 +08:00
Peter Guy
d660799723 Consolidate the several ghostty_surface_inherited_config
functions back into a single function with a second parameter for the source context.
2026-01-05 16:47:04 -08:00
Peter Guy
c035fb5385 Add an enum type for the C API 2026-01-05 16:47:04 -08:00
Peter Guy
dba0ff5339 Add C API function to handle new surfaces of different types 2026-01-05 16:47:04 -08:00
Peter Guy
7cf4c8dc53 Add context field to C config struct 2026-01-05 16:47:04 -08:00
Mitchell Hashimoto
14f592b8d4 macOS: Don't duplicate command palette entries for terminal commands
This is a regression introduced when we added macOS support for custom
entries. I mistakingly thought that only custom entries were in the
config, but we do initialize it with all!
2025-12-26 11:03:50 -08:00
Mitchell Hashimoto
017021787c config: RepeatableCommand cval 2025-12-24 14:26:47 -08:00
Mitchell Hashimoto
44972198ae apprt: add action for key table activation/deactivation 2025-12-20 19:53:12 -08:00
Mitchell Hashimoto
63422f4d4e add the catch_all binding key
Part of #9963

This adds a new special key `catch_all` that can be used in keybinding
definitions to match any key that is not explicitly bound. For example:
`keybind = catch_all=new_window` (chaos!). 

`catch_all` can be used in combination with modifiers, so if you want to
catch any non-bound key with Ctrl held down, you can do:
`keybind = ctrl+catch_all=new_window`.

`catch_all` can also be used with trigger sequences, so you can do:
`keybind = ctrl+a>catch_all=new_window` to catch any key pressed after
`ctrl+a` that is not explicitly bound and make a new window!

And if you want to remove the catch all binding, it is like any other:
`keybind = catch_all=unbind`.
2025-12-19 15:03:38 -08:00
himura467
4c6d3f8ed2 macos: add toggle_background_opacity keybind action 2025-12-16 11:32:10 -08:00
Mitchell Hashimoto
1a117c46e0 macos: fix missing goto_window union entry 2025-12-13 14:29:09 -08:00
Max Bretschneider
b344c978d0 Added GOTO_WINDOW to actions enum 2025-12-13 13:45:45 -08:00
Max Bretschneider
1c1ef99fb1 Window switching initial 2025-12-13 13:45:44 -08:00
Mitchell Hashimoto
dc7bc3014e add apprt action to notify apprt of surface readonly state 2025-12-12 13:13:54 -08:00
Matthew Hrehirchuk
547bcd261d fix: removed apprt action for toggle_readonly 2025-12-12 07:24:22 -08:00
Matthew Hrehirchuk
12bb2f3f47 feat: add readonly surface mode 2025-12-12 07:24:22 -08:00
Mitchell Hashimoto
65cf124e2c core: change apprt action to enum value instead of a new one 2025-12-11 16:09:45 -08:00
Mitchell Hashimoto
32033c9e1a core: prompt_tab_title binding and apprt action 2025-12-11 16:03:19 -08:00
George Papadakis
625d7274bf Add close tabs on the right action 2025-12-10 20:14:27 -08:00
Mitchell Hashimoto
2ee2d000f5 apprt actions for search progress 2025-11-26 08:50:05 -08:00
Mitchell Hashimoto
b7e70ce534 apprt: end_search 2025-11-26 08:50:04 -08:00