Commit Graph

8152 Commits

Author SHA1 Message Date
Max Bretschneider
4f02e6c096 Wrong action typo fix 2025-12-13 13:45:45 -08:00
Max Bretschneider
afbcfa9e3d Added GOTO_WINDOW to actions 2025-12-13 13:45:44 -08:00
Max Bretschneider
55ae4430b9 Formatting 2025-12-13 13:45:44 -08:00
Max Bretschneider
3000136e61 Changed switching previous/next to have no duplication 2025-12-13 13:45:44 -08:00
Max Bretschneider
1c1ef99fb1 Window switching initial 2025-12-13 13:45:44 -08:00
Mitchell Hashimoto
1805a9cb87 fix: explicitly allow preservation for TERMINFO in shell-integration (#9891)
Due to security issues, `sudo` implementations may not preserve
environment variables unless appended with `--preserve-env=list`.

Problem context: https://github.com/ghostty-org/ghostty/discussions/9861
2025-12-13 08:41:28 -08:00
Mitchell Hashimoto
c5d6b951e9 input: shift+backspace in Kitty with only disambiguate should do CSIu
Fixes #9868 (shift+backspace part only)
2025-12-13 07:18:22 -08:00
definfo
4a04efaff1 fix: explicitly allow preservation for TERMINFO in shell-integration
Due to security issues, `sudo` implementations may not preserve
environment variables unless appended with `--preserve-env=list`.

Signed-off-by: definfo <hjsdbb1@gmail.com>
2025-12-13 16:55:41 +08:00
Mitchell Hashimoto
7a1ff7779b feat: add readonly surface mode (#9130)
Tried my hand at #8432

Currently lacking tests and some sort of visual indicator that the
surface is locked.

Also, not entirely sure if I needed to touch `application.zig`.

Found what needed changing with help from Copilot (and added Docs w/
Copilot), but wrote most of the code myself.
2025-12-12 14:16:39 -08:00
Mitchell Hashimoto
182cb35bae core: remove readonly check 2025-12-12 14:15:43 -08:00
Mitchell Hashimoto
dc7bc3014e add apprt action to notify apprt of surface readonly state 2025-12-12 13:13:54 -08:00
Mitchell Hashimoto
0bf3642939 core: manage read-only through queueIo 2025-12-12 13:08:03 -08:00
Michael Hazan
6dd9a74e6e fix(docs): window-decoration is now none instead of false 2025-12-12 22:56:06 +02:00
Mitchell Hashimoto
29fdb541d5 make all IO message queueing go through queueIo so we can intercept 2025-12-12 12:00:28 -08:00
Michael Bommarito
2d9c83dbb7 fix: bash shell integration use-after-free bug
The ShellCommandBuilder uses a stackFallback allocator, which means
toOwnedSlice() may return memory allocated on the stack. When setupBash()
returns, this stack memory becomes invalid, causing a use-after-free.

This manifested as garbage data in the shell command string, often
appearing as errors like "/bin/sh: 1: ically: not found" (where "ically"
was part of nearby memory, likely from the comment "automatically").

The fix copies the command string to the arena allocator before returning,
ensuring the memory remains valid for the lifetime of the command.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 13:36:36 -05:00
Mitchell Hashimoto
b58ac983cf docs changes 2025-12-12 07:29:46 -08:00
Matthew Hrehirchuk
6369aaa93e Merge branch 'main' of github.com:ghostty-org/ghostty into feat/read-only 2025-12-12 07:24:48 -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
dd06d8a13b os/shell: introduce ShellCommandBuilder (#9881)
This builder is an efficient way to construct space-separated shell
command strings.

We use it in setupBash to avoid using an intermediate array of arguments
to construct our bash command line.
2025-12-12 07:09:58 -08:00
Jon Parise
04fecd7c07 os/shell: introduce ShellCommandBuilder
This builder is an efficient way to construct space-separated shell
command strings.

We use it in setupBash to avoid using an intermediate array of arguments
to construct our bash command line.
2025-12-12 08:59:44 -05:00
Mitchell Hashimoto
cba82e976c macOS: Change Tab Title (#9879)
This adds the ability to change a _tab_ title. The previous
functionality was tied to a specific _surface_. A tab title will stick
to the current tab regardless of active splits and so on.

This follows the nomenclature that macOS terminal app does which is
"title vs terminal title" (although we explicitly use "tab" in various
places, I may remove that in the future).

**This is macOS only. GTK is tracked here: #9880**. I did macOS only
because thats the machine I'm on. It'll be trivial to add this to GTK,
too.

## Demo


https://github.com/user-attachments/assets/d9446785-d919-4212-8553-db50c56c8c2f

(The option is also in the main menu, the context menu, and the command
palette)

## AI Disclosure

This PR was done fully with Amp, I didn't write a single line of code at
the time of writing this PR description. I reviewed everything though
and fully understand it all. Its a mimic more or less of the prompt
surface title work (although we did unify some stuff like the apprt
action).
2025-12-11 16:53:50 -08:00
Mitchell Hashimoto
6105344c31 macos: add change tab title to right click menu 2025-12-11 16:30:06 -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
Jon Parise
c0deaaba4e bash: use a shell command for shell integration
Prior to #7044, on macOS, our shell-integrated command line would be
executed under exec -l, which causes bash to be started as a login
shell. This matches the macOS platform norms.

The change to direct command execution meant that we'd skip that path,
and bash would start as a normal interactive (non-login) shell on macOS.
We fixed this in #7253 by adding `--login` to the `bash` direct command
on macOS.

This avoided some of the overhead of starting an extra process just to
get a login shell, but it unfortunately doesn't quite match the bash
environment we get when shell integration isn't enabled (namely, $0
doesn't get the login-shell-identifying "-" prefix).

Instead, this change implements the approach proposed in #7254, which
switches the bash shell integration path to use a .shell command, giving
us the same execution environment as the non-shell-integrated command.
2025-12-11 17:02:14 -05:00
Devzeth
b224b69054 fix(terminal): increase grapheme_bytes instead of hyperlink_bytes during reflow
When reflowing content with many graphemes, the code incorrectly increased hyperlink_bytes capacity
instead of grapheme_bytes, causing GraphemeMapOutOfMemory errors.
2025-12-11 07:03:12 -08:00
Mitchell Hashimoto
86503045e9 fix: prevent integer overflow in hash_map layoutForCapacity (#9871)
Closes #9862
2025-12-11 06:57:23 -08:00
benodiwal
0d8c193bda fix(terminal): prevent integer overflow in hash_map layoutForCapacity
Co-Authored-By: Sachin <sachinbeniwal0101@gmail.com>
2025-12-11 16:43:16 +05:30
Mitchell Hashimoto
3352d5f081 Fix up close right description 2025-12-10 20:57:36 -08:00
Mitchell Hashimoto
cca10f3ca8 Revert GTK UI changes, apple-sdk build stuff 2025-12-10 20:20:37 -08:00
George Papadakis
625d7274bf Add close tabs on the right action 2025-12-10 20:14:27 -08:00
Mitchell Hashimoto
7642b8bec4 build: highway system integration should default to false 2025-12-10 13:13:38 -08:00
Mitchell Hashimoto
143748a8d3 Add system integration for highway (#9642) 2025-12-10 13:00:46 -08:00
Mitchell Hashimoto
af05397219 synthetic: make bytes generation more flexible (#9204) 2025-12-10 12:59:46 -08:00
Mitchell Hashimoto
581ed72efc gtk: support GTK 4.20 media queries in runtime & custom css (#9520) 2025-12-10 12:55:25 -08:00
Mitchell Hashimoto
b66e4dc2cb build: skip git version detection when used as dependency (#9850)
When ghostty is used as a Zig dependency, detect this by comparing the
build root with ghostty's source directory. Skip git detection entirely
and use the version from build.zig.zon.

This fixes build failures when downstream projects have git tags that
don't match ghostty's version format. Previously, ghostty would read the
downstream project's git tags and panic at Config.zig:246 with:

\`\`\`
tagged releases must be in vX.Y.Z format matching build.zig
\`\`\`

**Reproduction:**
1. Create a project that uses ghostty as a Zig dependency
2. Tag the project with a version like \`v0.2.0\`
3. Run \`zig build\` → panic

**Fix:**
Use \`@src().file\` to get ghostty's source directory and compare it
with \`b.build_root\`. When they differ, ghostty is a dependency and we
skip git detection.

Thread:
https://ampcode.com/threads/T-197e6c33-b8f8-4b23-8fc8-7f6b6edd9f35
2025-12-10 12:46:10 -08:00
Tim Culverhouse
05c704b247 build: skip git version detection when used as dependency
Detect if ghostty is being built as a dependency by comparing the build
root with ghostty's source directory. When used as a dependency, skip
git detection entirely and use the version from build.zig.zon.

This fixes build failures when downstream projects have git tags that
don't match ghostty's version format. Previously, ghostty would read
the downstream project's git tags and panic at Config.zig:246 with
"tagged releases must be in vX.Y.Z format matching build.zig".
2025-12-10 12:43:14 -08:00
Mitchell Hashimoto
3b31cef965 tmux: control mode core loop (no GUI connections yet) (#9860)
Related to #1935

This adds a new structure `terminal.tmux.Viewer` which continues
building on all the prior tmux control mode work to add a full
bidirectional reconciliation loop to discover and sync terminal states
from tmux to Ghostty and vice versa. **This is the core, cross-platform
business logic that will power the GUIs, later.**

Our prior work were protocol building blocks, and this PR is an actual
functional piece of work. You can now start Ghostty, run `tmux -CC
attach`, and we _will_ be creating full blown terminals internal that
capture the content and mirror the state exactly (barring inevitable
bugs in something this complex). But, we don't yet show them visually.
:) And we don't yet send inputs to it (it's a viewer only, for now).

**This sucked.** The control mode protocol is difficult, to put it
mildly, for a variety of reasons. Correctness of this is going to be
hard. Therefore, I focused really hard on this design to make it **fully
unit test friendly.** We're able to simulate full tmux sessions and runt
through our state machine and assert various states. I think this will
be critical to correctness as we eventually collect real world data.

> [!WARNING]
>
> This does actually have user-impacting changes! When you run `tmux -CC
attach` we will now run our full control mode client. This could result
in bugs or crashes or other problems. This only activates if you have a
real tmux session, though, so it should be avoidable by most users.
Since we don't actually take our state and send it to the GUI or
anything, this should be pretty safe.

**AI disclosure:** I used AI for a lot of the protocol reverse
engineering and documentation to figure out how it all works. I designed
the architecture myself and implemented most of it manually.
2025-12-10 12:40:58 -08:00
Mitchell Hashimoto
37f467c023 terminal/tmux: docs 2025-12-10 10:37:52 -08:00
Mitchell Hashimoto
b3e7c92263 fmt 2025-12-10 10:34:37 -08:00
Mitchell Hashimoto
29bb18d8cd terminal/tmux: grab tmux version on startup 2025-12-10 10:34:30 -08:00
Mitchell Hashimoto
58000f5821 terminal/tmux: build up pane states 2025-12-10 10:12:51 -08:00
Mitchell Hashimoto
bf46c4ebe7 terminal/tmux: many more output formats 2025-12-09 21:10:46 -08:00
Mitchell Hashimoto
4c30c5aa76 terminal/tmux: cleanup command queue logic 2025-12-09 20:31:51 -08:00
Mitchell Hashimoto
582ea5d84b terminal/tmux: window add 2025-12-09 20:07:08 -08:00
Mitchell Hashimoto
1a2b3c165a terminal/tmux: layoutChanged handling 2025-12-09 17:09:57 -08:00
Mitchell Hashimoto
071070faa3 terminal/tmux: handle session_changed inside command loop 2025-12-09 14:21:07 -08:00
Mitchell Hashimoto
64ef640127 terminal/tmux: exhaustive switch for command 2025-12-09 13:56:16 -08:00
Mitchell Hashimoto
938e419e04 terminal/tmux: handle output events 2025-12-09 13:13:52 -08:00