Commit Graph

17478 Commits

Author SHA1 Message Date
Mitchell Hashimoto
df14efaf33 macos: preview images in the clipboard read confirmation dialog 2026-08-24 08:33:37 -07:00
Mitchell Hashimoto
c1f0ef73a9 macos: serve copied files as text/uri-list in Kitty clipboard reads 2026-08-24 08:18:36 -07:00
Mitchell Hashimoto
af9470b19b macos: Kitty clipboard reads support pw/name session grants 2026-08-24 08:18:36 -07:00
Mitchell Hashimoto
8c7a34d4c9 macos: Kitty clipboard reads serve all clipboard content types 2026-08-24 08:18:36 -07:00
Mitchell Hashimoto
0ce9054bf9 macos: implement Kitty clipboard protocol reads (OSC 5522) 2026-08-24 08:18:36 -07:00
Mitchell Hashimoto
a53771af01 libghostty: gate mode 5522 reports on clipboard read callback (#13990)
Report Kitty paste event mode 5522 as unrecognized when the stream
handler has no clipboard_read effect.

Previously libghostty-vt advertised Kitty paste events unconditionally
but Kitty clipboard reads can't work without a clipboard read effect
set.
2026-08-24 08:17:37 -07:00
Mitchell Hashimoto
94b6dae423 libghostty: gate mode 5522 reports on clipboard read callback
Report Kitty paste event mode 5522 as unrecognized when the stream
handler has no clipboard_read effect. 

Previously libghostty-vt advertised Kitty paste events
unconditionally but Kitty clipboard reads can't work without a clipboard
read effect set.
2026-08-24 07:29:44 -07:00
Mitchell Hashimoto
7a9bca6a6e macOS: fix responsiveness for repeated new tab action (#13985)
Fixes #13725
2026-08-24 06:58:12 -07:00
Mitchell Hashimoto
f9206be827 macOS: fix swiftlint warnings (#13986)
swiftlint 0.63.3 introduced a new rule called
[`legacy_swiftui_aspect_ratio`](76363aa4d7/CHANGELOG.md (L314))

<img width="509" height="451" alt="image"
src="https://github.com/user-attachments/assets/1ff6f593-ce8a-493e-a241-e9ae418746ee"
/>
2026-08-24 06:57:51 -07:00
Mitchell Hashimoto
874735a9af ci: update actions/upload-artifact pinned tag comment (#13989) 2026-08-24 06:57:35 -07:00
Jon Parise
2303bcf08d ci: update actions/upload-artifact pinned tag comment 2026-08-24 09:31:43 -04:00
Lukas
1d24eecb20 macOS: fix responsiveness for repeated new tab action 2026-08-24 11:37:34 +02:00
Lukas
6cf7e0cc54 macOS: fix swiftlint warnings
swiftlint 0.63.3 introduced a new rule called [`legacy_swiftui_aspect_ratio`](76363aa4d7/CHANGELOG.md (L314))
2026-08-24 11:34:38 +02:00
Lukas
6a508fd5e3 macos: translate physical menu shortcuts (#13888)
Translate printable physical keybindings through the current macOS
keyboard layout before assigning menu key equivalents. Previously these
bindings could not be represented because SwiftUI shortcuts are
character-based, so actions such as `super+backquote` had no native menu
shortcut.

Keep native keycodes as dispatch identity so translated display
characters do not change physical semantics or precedence over Unicode
bindings. Refresh shortcuts when the input source changes, and prevent
AppKit from transforming equivalents that are already localized.

**AI Usage:** The approach was suggested by GPT 5.6 Sol, but I wrote
most of the code and understand it all.
2026-08-24 09:55:02 +02:00
Mitchell Hashimoto
e77b2309fc libghostty: paste reads clipboard contents on demand, streams to pty (#13983)
Follow up to #13978

`ghostty_terminal_paste` no longer takes the clipboard's data up front.
The request now carries only the list of available MIME types plus a a
callback that writes one representation's bytes into a `GhosttyWriter`.

Previously an embedder had to load every representation for every MIME
type into memory before pasting. For a clipboard holding a large image
or video next to some text that could be hundreds of megabytes that were
never used.

I also took care to make sure that the data is only read once, to avoid
any time-of-check/time-of-use (TOCTOU) issues.

There is only one case where data might be fully buffered in memory now:
unsafe text data that needs to be checked. This is true for how Ghostty
GUI works today too.
2026-08-23 20:56:16 -07:00
Mitchell Hashimoto
da27e6c908 libghostty: paste reads clipboard contents on demand, streams to pty
Follow up to #13978

`ghostty_terminal_paste` no longer takes the clipboard's data up front.
The request now carries only the list of available MIME types plus a
a callback that writes one representation's bytes into a `GhosttyWriter`. 

Previously an embedder had to load every representation for every MIME
type into memory before pasting. For a clipboard holding a large image
or video next to some text that could be hundreds of megabytes that
were never used.

I also took care to make sure that the data is only read once, to avoid
any time-of-check/time-of-use (TOCTOU) issues.

There is only one case where data might be fully buffered in memory now:
unsafe text data that needs to be checked. This is true for how Ghostty
GUI works today too.
2026-08-23 20:40:40 -07:00
ghostty-vouch[bot]
a36dc245b0 Sync CODEOWNERS vouch list (#13981)
Sync CODEOWNERS owners with vouch list.

## Added Users

- @ollioddi
- @rkoten
- @tuananh
- @vasilmytsyk

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-24 00:26:53 +00:00
trag1c
9f0e1719dc i18n: update bg_BG translations (#13802) 2026-08-23 18:06:12 +02:00
Mitchell Hashimoto
e424060675 libghostty: centralize pasting to ghostty_terminal_paste, enable mode 5522 (#13978)
**Note: this has no changes for Ghostty GUI yet.** This only impacts
libghostty-vt.

This introduces a new `ghostty_terminal_paste` C API along with a
central `terminal.paste.paste` function that handles (1) mode 5522
(Kitty clipboard) (2) bracketed paste (3) normal paste all in one place,
combined with unsafe value detection and proper xterm-style newline
handling.

Terminal pasting is now stateful because for the Kitty clipboard
protocol in particular, it must mint "grants" that stay with the
terminal. Previously, paste encoding was stateless.

To start, this is only exposed/used by libghostty to enable Kitty
clipboard handling.

Other changes:

- **IO: randomSecure.** This also adds the `io.randomSecure`
implementation to `TinyIo` and a global sys override for it because
Kitty clipboard requires the ability to create one-time passwords and
the implementation (following Kitty) requires a crypto random source.
The sys model is for libghostty embedders.

- **New C result value: rejected.** This introduces a new C result enum
value "rejected" for values that are valid but rejected for some reason.
Its very possible that prior "invalid value" users will have to update
to this, and I recognize that its close to both but it fills an
important semantic difference.

Also note this still _eagerly_ requires all clipboard contents. I want
to move to a callback based model but it made the PR much more
complicated. I plan on playing with that before converting apprt's to
this.
2026-08-23 07:23:30 -07:00
ghostty-vouch[bot]
5834a0e3df Update VOUCHED list (#13977)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13976#discussioncomment-18121426)
from @pluiedev.

Denounce: @tangivis

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-23 05:15:39 +00:00
ghostty-vouch[bot]
da0093671a Update VOUCHED list (#13975)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13899#discussioncomment-18120807)
from @jcollie.

Vouch: @j-c-m

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-23 03:03:08 +00:00
Mitchell Hashimoto
60a1ae2df7 libghostty: add ghostty_terminal_paste C API with paste events example 2026-08-22 15:16:30 -07:00
Mitchell Hashimoto
dda8e6f314 sys: add secure random override option with a platform default 2026-08-22 15:16:30 -07:00
Mitchell Hashimoto
8760323165 terminal: add stream handler paste operation and enable mode 5522 in libghostty 2026-08-22 15:16:30 -07:00
Mitchell Hashimoto
a5bb22e235 terminal: add shared paste core with Kitty clipboard paste events 2026-08-22 15:14:39 -07:00
Mitchell Hashimoto
da5ddcb085 terminal: Kitty drag and drop protocol drop-only core logic and state machine (#13973)
This builds out the core logic and state machine for the Kitty drag and
drop protocol for _drops only_. This hooks it into libghostty-vt's Zig
API but it isn't available to the C API and it isn't hooked up to any
Ghostty GUI. It isn't really recommended that Zig consumers integrate
this yet because I'm sure the API will continue to change dramatically
as I address the missing features: drag source, remote drops, etc.

The major thing this does it the core `src/terminal/kitty/dnd.zig` stuff
with e2e tests extracted from Kitty's own `kitty_tets/dnd.py`. So this
verifies that what we have so far is working properly.
2026-08-22 10:07:09 -07:00
Mitchell Hashimoto
db2f8be590 terminal/kitty: dnd docs 2026-08-22 09:35:13 -07:00
Mitchell Hashimoto
af8d28a940 terminal/kitty: drag and drop stream handler 2026-08-22 09:34:03 -07:00
Mitchell Hashimoto
50f69b883c terminal/kitty: drag and drop drop state machine 2026-08-22 09:33:52 -07:00
Mitchell Hashimoto
38746b8c14 terminal/kitty: drag and drop response encoding 2026-08-22 09:33:44 -07:00
Mitchell Hashimoto
7c845e8af5 terminal/kitty: drag and drop command decoding 2026-08-22 09:33:37 -07:00
Mitchell Hashimoto
3b9c4e0ddb libghostty: implement Kitty clipboard protocol read/write (#13963)
This implements the full Kitty clipboard protocol for libghostty-vt.
libghostty users need to only have the clipboard read/write effect for
this to work. This doesn't yet do mode 5522.
2026-08-22 08:50:38 -07:00
Mitchell Hashimoto
4f49dc2b8b libghostty: implement Kitty clipboard protocol reads via clipboard_read effect 2026-08-22 07:02:09 -07:00
Jeffrey C. Ollie
5851d98615 gtk: avoid physical fallback for XKB modifiers (#13967)
Hi, I noticed that this XKB config line was causing problems for
Ghosttty:

```
    key <DELE> {   [ ISO_Level3_Shift ] };
```

That's a valid reconfiguration of the "delete key" as a modifier, and
the same worked find in other terminal emulators (like Alacritty). With
Ghosttty, I was getting actual `<delete>` behaviour whenever I pressed
the modifier key (although the modifier engaged after that).

This patch fixes it. In line with your AI disclose policy: I made the
patch with Codex Sol. The logical fix is very succinct, and the bulk of
the patch works around an underlying issue to do with GDK not
recognising some modifiers as modifiers. I've tested the implementation
and the patch definitely resolves it!
2026-08-22 03:55:34 -05:00
ghostty-vouch[bot]
d03cd1f534 Update VOUCHED list (#13970)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13966#discussioncomment-18114178)
from @jcollie.

Vouch: @by-nelson

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-22 08:54:25 +00:00
ghostty-vouch[bot]
2021d2addb Update VOUCHED list (#13969)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13968#discussioncomment-18113956)
from @pluiedev.

Vouch: @tothedarktowercame

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-22 08:15:28 +00:00
Joseph Corneli
ef01d5fda7 gtk: avoid physical fallback for XKB modifiers 2026-08-22 08:39:43 +01:00
Mitchell Hashimoto
6959fd46c6 libghostty: implement Kitty clipboard protocol write only
This implements only the clipboard _write_ side of the Kitty clipboard
protocol for libghostty-vt. libghostty users don't need to do anything,
this all automatically works since it just piggy-backs on the previous
clipboard write effect.

Clipboard reading is far more complicated because we don't have anything
designed yet for libghostty-vt that does async requests (e.g. to ask the
user for permission). I need to think about that more.
2026-08-21 21:16:14 -07:00
Mitchell Hashimoto
36676c5728 libghostty: clipboard_read effect, enables OSC52 reads (#13965)
This adds a `clipboard_read` effect to the stream terminal handler and a
matching `GHOSTTY_TERMINAL_OPT_CLIPBOARD_READ` callback to the
libghostty-vt C API so that embedders can answer OSC 52 read requests
(the `?` payload).

This is a _blocking_ effect: if the embedder needs to ask the user for
permission, the entire VT processing pipeline is _blocked_ during the
callback. This is a purposeful simplification choice compared to how
Ghostty GUI works with async requests. I think its reasonable, it
eliminates a TON of complexity.

If the effect isn't set, then any clipboard reads are denied.

This can be expanded easily to support Kitty clipboard protocol later.
2026-08-21 21:10:07 -07:00
Mitchell Hashimoto
e03475c0cc libghostty: clipboard_read effect, enables OSC52 reads
This adds a `clipboard_read` effect to the stream terminal handler and a
matching `GHOSTTY_TERMINAL_OPT_CLIPBOARD_READ` callback to the
libghostty-vt C API so that embedders can answer OSC 52 read requests
(the `?` payload). 

This is a _blocking_ effect: if the embedder needs to ask the user for
permission, the entire VT processing pipeline is _blocked_ during the
callback. This is a purposeful simplification choice compared to how
Ghostty GUI works with async requests. I think its reasonable, it
eliminates a TON of complexity.

If the effect isn't set, then any clipboard reads are denied.

This can be expanded easily to support Kitty clipboard protocol later.
2026-08-21 20:51:31 -07:00
Mitchell Hashimoto
ca9e5b1301 terminal/osc: kitty notification parsing feedback 2026-08-21 14:00:30 -07:00
Jeffrey C. Ollie
073bffcff4 osc 99: eliminate unnecessary inline switch branches 2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
07f33ad914 osc 99 & 5522: share metadata parsing code
Reduce redundant code by sharing the metadata parsing code
between the OSC 99 & OSC 5522 parsers.
2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
aa4ec3508e osc 99: address review feedback
* Fix typos.
* Eliminate metadata parsing code duplication.
* Improve documentation.
* Ensure assert is comptime only.
* Derive valid metadata characters from valid identifier characters.
2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
9a8e7ae186 core: add alias for Kitty desktop notification OSC struct 2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
301b69df43 osc: save terminator from OSC 99 in case we need to send a response 2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
202e639d97 osc: clean up comments in OSC 99 2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
93bf7d8104 osc: address review comments on OSC 99 (Kitty desktop notifications)
* Add comments to Option keys to clarify their usage without having
  to refer to the spec online.
* Use `indexOfNone` to simplify code.
2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
c67a1db991 osc: parse the Kitty desktop notification protocol (OSC 99)
This includes only parsing of the OSC. You cannot use OSC 99 to send
notifications. Uses lazy parsing of the metadata modelled on the new OSC
133 behavior.
2026-08-21 13:18:34 -07:00
Mitchell Hashimoto
819b241dec terminal: Kitty Clipboard core logic (no apprt hookups yet) (#13962)
This adds all the core logic and tests for the full Kitty Clipboard
protocol in the `src/terminal` package.

This is purposefully shaped similarly to the way we organize Kitty
graphics. There is an umbrella `clipboard.zig` and then a bunch of leaf
zig files that cover: request parsing, response encoding, state
management, etc. I think that worked really well for Kitty graphics so
we're doing it here too.

The core logic covers every part of the protocol: read and write.

The only thing hooked up to the end user is a DECRQM for mode 5522 will
return unset. And it can't be set currently (since it never works yet).
Outside of that, nothing in this diff is actually used in the real
binary.

**AI usage:** Validation against the spec and Kitty impl, test writing
and coverage validation, of course some code writing but within the
broad organizational shape I defined. I went through and either rewrote
or wrote all the comments myself plus this PR message.
2026-08-21 13:13:58 -07:00