Commit Graph

17057 Commits

Author SHA1 Message Date
Mitchell Hashimoto
82df79ec8d libghostty: replace Io.Threaded with custom Io impl (TinyIo)
Add a new Io implementation `TinyIo` that only supports the operations
we need and doesn't support concurrency. This shrinks the binary size
of libghostty by anywhere from ~100KB (macOS) to ~200KB (Linux) and 
runtime memory requirements by over 256KB (the thread-local storage
`std.Io.Threaded` creates plus the 18KB threaded structure is gone).

`TinyIo` is POSIX-only: Windows keeps std.Io.Threaded, and on
freestanding targets (wasm) TinyIo degrades to std.Io.failing
behavior just like before.  

It is also exported from the Zig module as `ghostty.TinyIo` so
Zig embedders can opt into the same size win when constructing
terminals.
2026-08-09 13:55:56 -07:00
Mitchell Hashimoto
579db41893 libghostty: log to stderr with raw writes, not lockStderr
see the prior commit, but most importantly this makes it so we can
replace our IO impl from Threaded.
2026-08-09 12:47:09 -07:00
Mitchell Hashimoto
f36854345e libghostty: skip stack traces in release panic handlers
The default Zig panic handler unwinds the stack and symbolicates it,
which drags in ~160KB worth of helper machinery. For an embedded library
this isn't great because the embedder's environment should be providing
this as long as libghostty is compiled with symbols or has a way to
symbolize.

Change ReleaseFast/ReleaseSmall libghostty-vt builds to use a custom
panic handler. Debug/ReleaseSafe keep the full Zig handlers.

This shrinks libghostty-vt on macOS by ~160KB (~9%).
2026-08-09 12:36:58 -07:00
Mitchell Hashimoto
0aa71d02ed terminal: reduce Parser.Action log formatting code size
Shrinks libghostty-vt dylib by ~2%.
2026-08-09 10:36:27 -07:00
Jeffrey C. Ollie
9d8fbd15b3 gtk: add +new-tab action (#11762)
This PR adds a `+new-tab` CLI action, useful for automation on GTK. This
mainly re-uses machinery added for the `+new-window`, but adds in a
unique surface ID for identifying surfaces for IPC purposes (and
eliminates use of raw pointers for callbacks from notifications).
2026-08-09 11:31:36 -05:00
Mitchell Hashimoto
2dc08839b1 build: fix Linux Android SDK fallback path (#13705)
Use the standard `~/Android/Sdk` capitalization for the Linux SDK
fallback.

This lets NDK discovery work when neither `ANDROID_NDK_HOME` nor an
`SDK` environment variable is set.
2026-08-09 08:04:28 -07:00
Mitchell Hashimoto
da59a2ec42 macOS: support drag-handle config (#13709)
Closes https://github.com/ghostty-org/ghostty/discussions/12332

Also a tiny rephrasing for the documentation.
2026-08-09 07:35:55 -07:00
Mitchell Hashimoto
349664f031 agents: remove double negative (#13710) 2026-08-09 07:31:48 -07:00
Jon Parise
fde9e281c4 agents: remove double negative 2026-08-09 10:13:44 -04:00
Lukas
74f91d1b43 macOS: support drag-handle config 2026-08-09 15:14:50 +02:00
Leah Amelia Chen
05221c11c9 core,gtk: add drag-handle config (#13706)
Fixes hundreds of complaints about the fact that drag handles cannot be
hidden, on GTK at least.

I'm not sure if we ever made an issue for this? If you come across any
discussions asking for this, please link them here :)
2026-08-09 20:10:38 +08:00
Leah Amelia Chen
850ca8c7b1 gtk: rebind is-split after moving split cross-tree
It turns out we never unbound the split from its original tree after
moving, which means `is-split` in particular is desynced and leads to
hilarious artifacts like how `unfocused-split-*` options just stop
working properly. I only realized this is a thing after the naïve
drag handle config option didn't work properly. Fun!
2026-08-09 16:09:02 +08:00
Leah Amelia Chen
65a3e666ef gtk: drag overlay toggle 2026-08-09 16:09:02 +08:00
Leah Amelia Chen
c6e7e9e4e2 config: add drag-handle 2026-08-09 16:09:00 +08:00
Fredrik Fornwall
16e13a59ae build: fix Linux Android SDK fallback path
Use the standard ~/Android/Sdk capitalization for the Linux SDK fallback.

This lets NDK discovery work when neither ANDROID_NDK_HOME nor an SDK
environment variable is set.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2026-08-09 05:37:06 +02:00
Mitchell Hashimoto
f64f4aca2c lib-vt: answer XTGETTCAP queries (#13530)
Ghostty's full termio path answers XTGETTCAP from the static terminfo
map, but `terminal/stream_terminal.zig`, which backs libghostty-vt,
parses the same DCS request and then discards it. There is no XTGETTCAP
effect either, so an embedder cannot restore the replies through the C
API.

Programs query these over SSH instead of assuming the remote host has
the client's terminfo entry. This matters more for an embedder than for
the desktop app, which can install its entry on the remote through shell
integration.

Answer the queries in `stream_terminal` the same way termio does: look
up each requested key in the static terminfo map and write the reply to
the pty, skipping the lookups entirely when no `write_pty` effect is
set. The map now stores null-terminated responses so they can be handed
straight to `write_pty` without copying. `terminal/dcs.zig` and the
termio path are unchanged.

`TN` is handled separately. It names the terminfo entry the terminal
runs as, so it has to agree with `TERM` — which is set in
`termio/Exec.zig`, a layer libghostty-vt does not contain. The library
never sees `TERM` and cannot answer on the embedder's behalf, and
answering with Ghostty's own entry from the static map would misreport
every embedder, so `TN` is intercepted before the map lookup. The name
is instead configured through a new option,
`GHOSTTY_TERMINAL_OPT_TERMINFO_NAME`: the string is copied into the
terminal, names longer than 128 bytes are rejected, and while unset the
query goes unanswered.

This is the first dependency from `src/terminal` on `src/terminfo`, so
libghostty-vt now carries Ghostty's terminfo table: +16,023 bytes
(+1.9%) on a `wasm32-freestanding` `ReleaseSmall` build.

---

AI usage: Created with claude code and opus 5. I have reviewed the code
and made modifications where it made sense. I have also tested this end
to end in an application.
2026-08-08 20:26:05 -07:00
Fredrik Fornwall
74efadb446 lib-vt: answer XTGETTCAP queries
Ghostty's full termio path answers XTGETTCAP from the static terminfo
map, but terminal/stream_terminal.zig, which backs libghostty-vt,
parses the same DCS request and then discards it. There is no XTGETTCAP
effect either, so an embedder cannot restore the replies through the
C API.

Programs query these over SSH instead of assuming the remote host has
the client's terminfo entry. This matters more for an embedder than for
the desktop app, which can install its entry on the remote through
shell integration.

Answer the queries in stream_terminal the same way termio does: look
up each requested key in the static terminfo map and write the reply
to the pty, skipping the lookups entirely when no write_pty effect is
set. The map now stores null-terminated responses so they can be
handed straight to write_pty without copying. terminal/dcs.zig and the
termio path are unchanged.

"TN" is handled separately. It names the terminfo entry the terminal
runs as, so it has to agree with TERM -- which is set in
termio/Exec.zig, a layer libghostty-vt does not contain. The library
never sees TERM and cannot answer on the embedder's behalf, and
answering with Ghostty's own entry from the static map would misreport
every embedder, so "TN" is intercepted before the map lookup. The name
is instead configured through a new option,
GHOSTTY_TERMINAL_OPT_TERMINFO_NAME: the string is copied into the
terminal, names longer than 128 bytes are rejected, and while unset
the query goes unanswered.

This is the first dependency from src/terminal on src/terminfo, so
libghostty-vt now carries Ghostty's terminfo table: +16,023 bytes
(+1.9%) on a wasm32-freestanding ReleaseSmall build.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2026-08-08 20:15:40 -07:00
Mitchell Hashimoto
163e229756 Update iTerm2 colorschemes (#13704)
Upstream release:
https://github.com/mbadolato/iTerm2-Color-Schemes/releases/tag/release-20260803-155300-875a82f
2026-08-08 19:53:00 -07:00
Mitchell Hashimoto
94beef81ef libghostty: effect for unknown sequence (APC only this PR) (#13702)
This introduces a new effect for Zig/C callers to detect unknown
sequences.

This PR starts only with APC, but the API shape is such that we can add
other types (OSC next) in future PRs. The goal of this is to have zero
overhead in the disabled/undetected (both) case, and minimal overhead in
the detected case.

This is important in particular for libghostty consumers because it
allows them to implement their own custom protocols and/or support
features libghostty doesn't support. It isn't possible to support them
at the same performance libghostty does but supporting them in general
is usually valuable.

From a Zig API to enable this, users must set `unknown_max_bytes` for
the APC handler AND update their stream handler to recognize unknown
sequences. The built-in `stream_terminal` stream type has an exposed
callback for this, so both must be set.
2026-08-08 19:52:49 -07:00
mitchellh
7e8b4f360b deps: Update iTerm2 color schemes 2026-08-09 00:28:40 +00:00
Mitchell Hashimoto
6b990de5be terminal: C API for unknown sequences 2026-08-08 16:49:45 -07:00
Leah Amelia Chen
136f436a3b gtk/wayland: clean up blur regions (#13699)
Fix two resource leaks when the Wayland background blur region changes.

Temporary `wl_region` objects were destroyed only after an error. They
are now always destroyed after the blur request. The previous cached
blur region is also released before its replacement.

This change does not alter protocol selection or add new Wayland
protocols.

Testing:

- Verified blur on KDE Plasma 6.7.4 with GTK 4.22.4.
- Verified with `zig build -Doptimize=ReleaseFast`.

This code was written with assistance from GPT 5.6 Sol and manually
reviewed.
2026-08-09 01:38:49 +08:00
Omkar Chandorkar
a6fc3e0e2e gtk/wayland: clean up blur regions
Destroy temporary Wayland regions after each blur update and release
the previous cached blur region before replacing it. This prevents
resources from leaking while the blur region changes.
2026-08-08 22:28:41 +05:30
ghostty-vouch[bot]
6e647a1cbd Update VOUCHED list (#13697)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/13693#issuecomment-5227046478)
from @tristan957.

Vouch: @gotenksIN

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-08 16:40:24 +00:00
Mitchell Hashimoto
b537282411 terminal/apc: support reporting unknown APC sequences 2026-08-08 08:54:32 -07:00
Mitchell Hashimoto
afb351f838 terminal/stream: fast-path APC termination
APC payload bytes are bulk consumed, but the terminating byte still passed 
through the generic parser action loop. Handle ESC and C1 ST directly after 
bulk consumption while leaving other transitions on the scalar path.
2026-08-08 08:54:16 -07:00
Jeffrey C. Ollie
034506f145 gtk: add +new-tab cli action 2026-08-08 10:34:45 -05:00
ghostty-vouch[bot]
47147324ce Update VOUCHED list (#13691)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/13690#issuecomment-5224579870)
from @00-kat.

Vouch: @a-lang

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-08 04:50:39 +00:00
Mitchell Hashimoto
2602886144 macOS: fix quit alert missing when hidden (#13686)
Fixes https://github.com/ghostty-org/ghostty/discussions/13685.

Removed presumably deprecated check introduced in
8f1a014afd for update pill
> I checked for auto update as well, it works as before this, and for
manual updates we're not confirming anyway, so I think its safe to
remove it now.

Each BaseTerminalController already has quit check and confirming code
added in that review windows pr. It didn't cover QT before, overriding
it to animate in for showing alert.

[#5450](https://github.com/ghostty-org/ghostty/issues/5450) stays fixed.




https://github.com/user-attachments/assets/dbf36f16-e3ce-4f6a-bc25-367fe48739b9
2026-08-07 13:21:50 -07:00
Lukas
e83cf0b06f macOS: fix quit alert missing when hidden 2026-08-07 20:11:16 +02:00
Mitchell Hashimoto
4693e1b546 macos: sync appearance when new windows are created (#13675)
For new windows to get their appearance synced, we need to call
`syncAppearance` after `super.showWindow(sender)`. All previous calls to
`syncAppearance` on `TerminalWindow` will be ignored because the window
needs to have `isVisible` set to `true`.

This regression was introduced by:
5368adcd29

It added `.dropFirst()` to the `focusedSurface` appearance publishers in
`TerminalController.swift` which removes the initial call of the
subscription.

Fixes https://github.com/ghostty-org/ghostty/issues/13324

(landed on the same fix as @rasitakyol found here:
https://github.com/ghostty-org/ghostty/pull/13341)
2026-08-07 08:02:54 -07:00
Mitchell Hashimoto
34282fc7b3 macOS: fix swiftlint (#13684) 2026-08-07 07:55:39 -07:00
Mitchell Hashimoto
204989ad90 terminal/snapshot: remove BLAKE3 digests (#13680)
Remove BLAKE3 prefix digests. Keep READY/FINISH as empty records since
they're semantically important markers.

Our existing format (CRC32 per-record, declared counts, strict tag
ordering requirements, etc.) already detect: accidental corruption,
truncation, data omission, and duplication.

BLAKE3 only protects against valid records being swapped or removed
entirely. It is heavy for just that, and callers can solve that anyways
via their own transport (like, just use TCP). For more adversarial
protection, callers can also add layers like TLS or their own alternate
signing methods depending on their own threat models.

Removing the hash improves encode times by ~1.4x, decode times by ~1.3x.
Time-to-READY decoding is effectively unchanged because it was such a
small package to begin with.

**AI usage:** I had it clean up the comments and the tests, but I did
the blake3 removal and marker changes, and wrote the commit message
myself. All reviewed.
2026-08-07 07:53:24 -07:00
Mitchell Hashimoto
0a78672e7c build: fix flatpak/snap, restore rpath opt, fix local gtk4-layer-shell (#13677)
This fixes regressions in the flatpak/snap builds, and knock-on stuff
that was discovered as as a result:

* Update the Zig versions in the flatpak/snap build configuration files.
* Restore the classic `-Dpatch-rpath` option, and add a new
`-Dpatch-interp` option. This ensures that the snap can still use
`-Dpatch-rpath` correctly.
* There seems to be an issue in Zig when parsing IPv6 addresses that
leads to issues loading `resolv.conf` files; when trying to load a
nameserver that has an IPv6 address with a numeric interface index as
the scoped zone ID, Zig will try to resolve the interface as a name
rather than just use the index. This is coming up in snap builds because
the build process seems to, by default, use the exhaustive
`/run/systemd/resolve/resolv.conf` file, versus the simpler stub
(`stub-resolv.conf`) file. We work around this for the time being by
linking the stub at the end of the Zig part, overwriting the link to the
non-stub file.
* Fixed `gtk4-layer-shell` packaging - the migration to external
translate-c meant that non-system builds of the dependency were not
handing the local `gtk4-layer-shell` headers over for translation. Now,
instead, we've extracted the management of the `gtk4-layer-shell` source
and `wayland-protocols` generation to a locally-cached object so that
the source can be shared by both C translation and the library build in
a way that is not coupled to any particular step.
2026-08-07 07:52:31 -07:00
Lukas
fd98370211 macOS: fix swiftlint 2026-08-07 16:51:19 +02:00
Mitchell Hashimoto
faeac91fa5 macOS: fix window sizing after dragging a split into a window (#13682)
Regression from
[#13601](https://github.com/ghostty-org/ghostty/issues/13601), but I
don't see why it matters. But the surface's bounds changes after
window's created.
2026-08-07 07:38:48 -07:00
Mitchell Hashimoto
571c62dada font/coretext: creation functions can return null, handle OOM (#13679)
Catch NULL results from CoreFoundation/CoreText creation functions and
return error.OOM rather than null derefs later. I verified that this is
possible but didn't verify the behavior when it happens, this is just
defensive based on the report here: #13671 because it costs us nothing
really.
2026-08-07 07:38:14 -07:00
ghostty-vouch[bot]
7f96e0bdab Update VOUCHED list (#13683)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/13675#issuecomment-5218250080)
from @jcollie.

Vouch: @zenangst

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-07 14:23:01 +00:00
Mitchell Hashimoto
fcee19819e macos: discard debounced selection notification (#13676)
Discard the selection notification payload before debouncing
accessibility changes.

The debouncer previously retained the notification and its surface
object, keeping a closed tab's view and PTY alive after the undo
timeout.
2026-08-07 07:14:54 -07:00
Lukas
96826853bd macOS: fix window sizing after dragging a split into a window 2026-08-07 15:14:30 +02:00
Jeffrey C. Ollie
7e567c3f03 cli: add g/G as vi-style aliases for Home/End in list-themes (#13681)
I was messing around with this tool the other day on a 60% keyboard so I
thought this would be a nice addition for situations like that. Keeps in
line with the vi/less j and k inputs that this tool has as well.
2026-08-06 22:45:47 -05:00
Owen Giles
987f44260d cli: add g/G as vi-style aliases for Home/End in list-themes 2026-08-06 21:48:36 -05:00
Mitchell Hashimoto
219173ab37 terminal/snapshot: remove BLAKE3 digests
Remove BLAKE3 prefix digests. Keep READY/FINISH as empty records since
they're semantically important markers.

Our existing format (CRC32 per-record, declared counts, strict tag ordering
requirements, etc.) already detect: accidental corruption, truncation,
data omission, and duplication. 

BLAKE3 only protects against valid records being swapped or removed entirely. 
It is heavy for just that, and callers can solve that anyways via their
own transport (like, just use TCP). For more adversarial protection,
callers can also add layers like TLS or their own alternate signing
methods depending on their own threat models.

Removing the hash improves encode times by ~1.4x, decode times by ~1.3x.
Time-to-READY decoding is effectively unchanged because it was such a 
small package to begin with.
2026-08-06 14:12:08 -07:00
Mitchell Hashimoto
daeed25b37 font/coretext: creation functions can return null, handle OOM
Catch NULL results from CoreFoundation/CoreText creation functions and
return error.OOM rather than null derefs later. I verified that this is
possible but didn't verify the behavior when it happens, this is just
defensive based on the report here: #13671 because it costs us nothing
really.
2026-08-06 13:47:06 -07:00
Mitchell Hashimoto
f9b2ad8dbe input: update toggle_maximize documentation (#13673)
## AI Closure

Claude found and changed it
2026-08-06 13:15:05 -07:00
Chris Marchesi
b9113d2e7f build: fix flatpak/snap, restore rpath opt, fix local gtk4-layer-shell
This fixes regressions in the flatpak/snap builds, and knock-on stuff
that was discovered as as a result:

* Update the Zig versions in the flatpak/snap build configuration files.
* Restore the classic -Dpatch-rpath option, and add a new -Dpatch-interp
  option. This ensures that the snap can still use -Dpatch-rpath
  correctly.
* There seems to be an issue in Zig when parsing IPv6 addresses that
  leads to issues loading resolv.conf files; when trying to load a
  nameserver that has an IPv6 address with a numeric interface index as
  the scoped zone ID, Zig will try to resolve the interface as a name
  rather than just use the index. This is coming up in snap builds
  because the build process seems to, by default, use the exhaustive
  /run/systemd/resolve/resolv.conf file, versus the simpler stub
  (stub-resolv.conf) file. We work around this for the time being by
  linking the stub at the end of the Zig part, overwriting the link to
  the non-stub file. 
* Fixed gtk4-layer-shell packaging - the migration to external
  translate-c meant that non-system builds of the dependency were not
  handing the local gtk4-layer-shell headers over for translation. Now,
  instead, we've extracted the management of the gtk4-layer-shell source
  and wayland-protocols generation to a locally-cached object so that
  the source can be shared by both C translation and the library build
  in a way that is not coupled to any particular step.
2026-08-06 13:08:33 -07:00
Mitchell Hashimoto
44a05a88aa macos: discard debounced selection notification
Discard the selection notification payload before debouncing
accessibility changes.

The debouncer previously retained the notification and its surface
object, keeping a closed tab's view and PTY alive after the undo
timeout.
2026-08-06 13:05:37 -07:00
Christoffer Winterkvist
e11bfb5139 macos: sync appearance when new windows are created (#13324)
call `syncAppearance` after `super.showWindow` has been called to
ensure that the window is visible.
2026-08-06 19:53:48 +02:00
Lukas
c011ad8707 Update wording
Co-authored-by: Tristan Partin <tristan@partin.io>
2026-08-06 19:38:18 +02:00
Claude Opus 5 (1M context)
a14eba7478 input: update toggle_maximize documentation 2026-08-06 19:13:29 +02:00