Commit Graph

17031 Commits

Author SHA1 Message Date
Leah Amelia Chen
c6e7e9e4e2 config: add drag-handle 2026-08-09 16:09:00 +08: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
Mitchell Hashimoto
22d13172cd macOS: fix unsupported action falls through wrong handling (#13668)
There're won't be any visible errors, but
`keybind=cmd+r=toggle_tab_overview/toggle_window_decorations/size_limit/quit_time`
shouldn't go to `showChildExited`

## AI Disclosure

Found by Claude during another quest, but I changed on myself.
2026-08-06 07:32:22 -07:00
Leah Amelia Chen
111877354e core,gtk: add move_tab_to_new_window action (#13621)
Implements most of #2630

This is in reality a really simple change and ideally we can get this
out before the 1.4 string freeze
2026-08-06 22:22:35 +08:00
Lukas
18f06ef03c macOS: fix unsupported action falls through wrong handling 2026-08-06 16:17:11 +02:00
Mitchell Hashimoto
afa9e4fad0 libghostty: add configurable mode defaults, remove mode_set/get (#13661)
ABI BREAKING: This removes `ghostty_terminal_mode_get` and `_mode_set`.
We can now represent these operations completely with standard
`ghostty_terminal_get` and `ghostty_terminal_set`, which makes it much
more flexible to preserve ABI in the future.

This is all centered around a new `GhosttyTerminalModeConfig` structure
that is an in or out parameter depending on use case.

This also adds a new `GHOSTTY_TERMINAL_OPT_MODE_DEFAULT` option that can
be used to set the _default_ value of mode that happens when a RIS event
(full reset) is sent. Note that not all modes are configurable because
some are set based on live terminal state and aren't modes in and of
themselves.

## Why Delete Functions? Why Not Add?

Once tagged, the goal of `libghostty-vt` is to remain HIGHLY ABI
compatible. We are striving for top tier ABI compatibility similar to
legendary C libraries. That means we need to be highly confident in our
API shapes: functions, structs, etc. and using shapes that we can retain
ABI compatibility even as we add features. Every function is a risk. By
pushing stuff into our `_get/_set` patterns, its easier to maintain ABI
compatibility.
2026-08-06 06:45:54 -07:00
Mitchell Hashimoto
99c483f477 macOS: hide settings menu icon on macOS 27 (#13664)
Settings appears to be somehow special and it's not hidden previously.

This would require building with Xcode 27 tho.

<img width="704" height="364" alt="image"
src="https://github.com/user-attachments/assets/2cb23a01-6840-40a2-b794-6a8e914aaa7d"
/>
2026-08-06 06:45:41 -07:00
Mitchell Hashimoto
33bdeed1cb macOS: remove flaky color match tests (#13667) 2026-08-06 06:45:14 -07:00
Lukas
76907d8de8 macOS: remove flaky color match tests 2026-08-06 15:11:48 +02:00
Lukas
301bd6f8b0 macOS: hide settings menu icon on macOS 27
Settings appears to be somehow special and it's not hidden previously.
2026-08-06 12:21:36 +02:00
Mitchell Hashimoto
ec58fbc6a2 build: default dependencies to lib-vt mode to avoid Xcode requirements (#13660)
Related to #10651

Default Ghostty dependency builds to libghostty-vt-only mode and avoid
initializing anything that would trigger broader dependency
requirements.

The impact of this is that Zig consumers can import ghostty-vt without
requiring Xcode on macOS.
2026-08-05 22:20:28 -07:00
Mitchell Hashimoto
cfc19e8053 libghostty: add configurable mode defaults, remove mode_set/get
ABI BREAKING: This removes `ghostty_terminal_mode_get` and `_mode_set`.
We can now represent these operations completely with standard 
`ghostty_terminal_get` and `ghostty_terminal_set`, which makes it much
more flexible to preserve ABI in the future.

This is all centered around a new `GhosttyTerminalModeConfig` structure
that is an in or out parameter depending on use case.

This also adds a new `GHOSTTY_TERMINAL_OPT_MODE_DEFAULT` option that
can be used to set the _default_ value of mode that happens when a RIS
event (full reset) is sent.
2026-08-05 22:07:25 -07:00
Mitchell Hashimoto
49fd1ae654 build: default dependencies to lib-vt mode
Related to #10651

Default Ghostty dependency builds to libghostty-vt-only mode and
avoid initializing anything that would trigger broader dependency
requirements.

The impact of this is that Zig consumers can import ghostty-vt without
requiring Xcode on macOS.
2026-08-05 22:01:49 -07:00
Mitchell Hashimoto
f948d42076 termio: replace SegmentedPool with std.MemoryPool (#13659)
The purpose of SegmentedPool was pointer-stable values for the pty write
path, and the std.MemoryPool provides that.

SegmentedPool is actually so old it predates a stdlib memory pool! Just
noting why I did it in the first place. I also wrote it when I was
pretty fucking bad at Zig, so I'm shocked its lasted this long.

The write path is hot , so the replacement was benchmarked against the
old SegmentedPool plus a rewrite simple Pool I did before realizing...
wait... why not just a MemoryPool. Benchmarked using the real 240-byte
xev write request.

```
  workload                    old                     std.MemoryPool
  depth-1 (keystroke echo)    3.93 ns/op              0.96 ns/op
  burst (1MiB paste, d=256)   4.27 ns/op              1.00 ns/op
  cold growth (32 -> 16k)     4.54 ns/op              6.48 ns/op
  malloc create/destroy       15.9 ns/op              (baseline)
```

Cold growth is slower but this is only a cost when the pool grows.

Note this also gets rid of the preallocation, which didn't show any
measurable performance benefit at all. This has the benefit of shrinking
our ThreadData by ~10KB.

This was motivated by #13655
2026-08-05 21:06:16 -07:00
Mitchell Hashimoto
e0ef934f73 termio: replace SegmentedPool with std.MemoryPool
The purpose of SegmentedPool was pointer-stable values for the pty write
path, and the std.MemoryPool provides that. 

SegmentedPool is actually so old it predates a stdlib memory pool!
Just noting why I did it in the first place. I also wrote it when I was
pretty fucking bad at Zig, so I'm shocked its lasted this long.

The write path is hot , so the replacement was benchmarked against the old 
SegmentedPool plus a rewrite simple Pool I did before realizing...
wait... why not just a MemoryPool. Benchmarked using the real 240-byte xev
write request.

  workload                    old                     std.MemoryPool
  depth-1 (keystroke echo)    3.93 ns/op              0.96 ns/op
  burst (1MiB paste, d=256)   4.27 ns/op              1.00 ns/op
  cold growth (32 -> 16k)     4.54 ns/op              6.48 ns/op
  malloc create/destroy       15.9 ns/op              (baseline)

Cold growth is slower but this is only a cost when the pool grows.

Note this also gets rid of the preallocation, which didn't show any
measurable performance benefit at all. This has the benefit of shrinking
our ThreadData by ~10KB.
2026-08-05 20:58:33 -07:00
Mitchell Hashimoto
63da4e84d4 lib: remove backported cutPrefix implementation (#13658)
We can use std.mem.cutPrefix directly now that we're on Zig 0.16.
2026-08-05 20:47:26 -07:00
Jeffrey C. Ollie
e1fc390c19 GTK: move audio bell processing to the application (#13657)
This fixes #13647 by using at most one GStreamer thread per application.
This was previously addressed in #12815 which used at most one GStreamer
thread per surface. Originally discussed in #12808.
2026-08-05 22:34:08 -05:00
Jon Parise
1d6bc68298 lib: remove cutPrefix implementation
We can use std.mem.cutPrefix directly now that we're on Zig 0.16.
2026-08-05 23:07:43 -04:00
Jeffrey C. Ollie
f0f3f4d8d8 GTK: move audio bell processing to the application
This fixes #13647 by using at most one GStreamer thread per application.
This was previously addressed in #12815 which used at most one GStreamer
thread per surface. Originally discussed in #12808.
2026-08-05 20:10:53 -05:00
Mitchell Hashimoto
8eecb8fdbf terminal: release Kitty placement pins on eviction (#13656)
Image eviction removed associated placements from storage without
deinitializing them. Pin-backed placements therefore remained registered
with the screen after eviction, allowing graphics-heavy output to
accumulate stale tracked pins.

Pass the owning screen through image insertion and eviction, and
deinitialize each placement before removing it. Cover both the released
pin and a retained image's live pin in the eviction regression test.
2026-08-05 16:31:23 -07:00
Mitchell Hashimoto
ea21a2f141 core: avoid allocating for pwd change actions (#13654)
Surface.handleMessage allocated a null-terminated copy for every working
directory update. OSC 7 values fit within the parser's 2 KiB fixed
buffer, so use stack-fallback storage sized for that bound and its
terminator.

The message type does not enforce the OSC bound, so an oversized future
producer still falls back to the heap. performAction already borrows the
value only for the duration of the call, preserving its existing
lifetime.
2026-08-05 16:28:50 -07:00
Amp
b5e86a4284 terminal/kitty: release evicted placement pins
Image eviction removed associated placements from storage without
deinitializing them. Pin-backed placements therefore remained registered
with the screen after eviction, allowing graphics-heavy output to
accumulate stale tracked pins.

Pass the owning screen through image insertion and eviction, and
deinitialize each placement before removing it. Cover both the released
pin and a retained image's live pin in the eviction regression test.

Co-authored-by: Tim Culverhouse <tfc@ampcode.com>
2026-08-05 23:10:17 +00:00
Jon Parise
f1d225020a core: avoid allocating for small pwd change actions
Surface.handleMessage allocated a null-terminated copy for every working
directory update.

Use a small 256-byte stack-fallback buffer for common working directory
lengths without adding significant pressure to this deep call stack. Longer
paths retain the existing heap behavior, and performAction continues to borrow
the value only for the duration of the call.
2026-08-05 18:31:27 -04:00
Mitchell Hashimoto
e88601239d macOS: update command options match order (#13624)
Matches are sorted in the following order:
leadingColor > title > subtitle > description.

Ranking is lexicographic on (colorScore, textScore)

<img height="300" alt="image"
src="https://github.com/user-attachments/assets/1ec99e67-537e-4fc6-b595-d7eec8cbf31d"
/>


### AI Disclosure

Claude reviewed and added unit tests, also did some refactoring of my
original implementation.
2026-08-05 15:29:50 -07:00
Mitchell Hashimoto
9cb2147641 terminal/kitty: evict without scratch allocation (#13627)
Track each image's placement count in its existing metadata. This lets
us use constant-time usage checks (rather than scans) during eviction.

Select the best candidate directly from storage on each eviction,
preserving the existing priority order: unused status, transient hint,
generation, then ID.

Since eviction no longer allocates, it can't fail, so callers no longer
need to handle out-of-memory conditions.
2026-08-05 15:28:41 -07:00
Mitchell Hashimoto
090d161b28 terminal: report overline in DECRQSS SGR response (#13653)
#11638

Report SGR 53 when the active cursor style has overline enabled.
2026-08-05 15:20:19 -07:00
Mitchell Hashimoto
a61e15efd5 terminal/kitty: fix point deletion calculations (d=p, d=c) (#13652)
Fixes https://github.com/ghostty-org/ghostty/discussions/12346

Fix d=p and d=c point deletion so only placements intersecting the
target cell are removed.

Previously, placements spanning multiple rows could be deleted from
columns outside the target because the page-order comparison flattened
row and column coordinates.

Check the rectangle's column independently and use page order only for
its row span, matching Kitty's implementation:
https://github.com/kovidgoyal/kitty/blob/master/kitty/graphics.c

NOTE: I did not look at Kitty's source prior to fixing this. I only
referenced it after the fix to verify that the behavior matches.

Spec:
https://sw.kovidgoyal.net/kitty/graphics-protocol/#deleting-images
2026-08-05 15:20:05 -07:00
Mitchell Hashimoto
ae0ff51c42 macos: defer overlapping clipboard completion (#13648)
Fixes #13074

Overlapping clipboard confirmations now defer denial until the next main
queue turn rather than completing inside the confirmation callback.

This prevents the native request state from being invalidated while its
callback is still active, avoiding the OSC 52 crash reported in #13074.

The deferred closure retains the originating surface view and completes
the ignored request with empty data, preserving the existing deny
behavior.
2026-08-05 15:19:34 -07:00