Commit Graph

13328 Commits

Author SHA1 Message Date
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
Jeffrey C. Ollie
5dd4e60c31 Fix typo in po/README_TRANS (#9870)
via the its -> via its
2025-12-11 10:06:54 -06:00
Mitchell Hashimoto
c45a762031 fix(terminal): increase grapheme_bytes instead of hyperlink_bytes during reflow (#9866)
Fixed: When reflowing content with many graphemes, the code incorrectly
increased hyperlink_bytes capacity
instead of grapheme_bytes, causing GraphemeMapOutOfMemory errors.

Added: An unit test for this specific issue. 

This PR was written primarily by Opus.

Closes: #9863
2025-12-11 07:06:51 -08: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
Felipe M.B.
3b2f551dc0 Fix typo in po/README_TRANS
via the its -> via its
2025-12-11 07:54:20 -03:00
Jeffrey C. Ollie
dd4493b153 Fix typo in po/README_CONTRIB (#9869)
Change translable to translatable.
2025-12-11 01:54:50 -06:00
Felipe M.B.
f96aca7a3f Fix typo in po/README_CONTRIB
Change translable to translatable.
2025-12-11 04:13:19 -03:00
Mitchell Hashimoto
669733d597 macos: remove iOS signing (dev team) 2025-12-10 21:21:05 -08:00
Mitchell Hashimoto
4a6d551941 macos: don't put NSMenu extension in iOS build 2025-12-10 21:20:39 -08:00
Mitchell Hashimoto
a531ea8b08 Add close tabs on the right action (#9783)
<img width="1694" height="1146" alt="image"
src="https://github.com/user-attachments/assets/f9e1e7e6-7cfe-4760-85fe-def7c10f4110"
/>
2025-12-10 21:09:13 -08:00
Mitchell Hashimoto
3352d5f081 Fix up close right description 2025-12-10 20:57:36 -08:00
Mitchell Hashimoto
eb75d48e6b macos: add xmark to other tab close items 2025-12-10 20:56:07 -08:00
Mitchell Hashimoto
1387dbefad macos: target should be the correct target 2025-12-10 20:50:28 -08:00
Mitchell Hashimoto
dc641c7861 macos: change to NSMenu extension 2025-12-10 20:47:15 -08:00
Mitchell Hashimoto
f612e4632c macos: clean up some style on tab bar context menu configuring 2025-12-10 20:43:43 -08:00
Mitchell Hashimoto
4424451c59 macos: remove to "close to the right" 2025-12-10 20:28:27 -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
894e8d91ba macOS: fix tab context menu opens on macOS 26 with titlebar tabs (#9831)
Description:
Context menu works on tabs with titlebar-style=tabs on MacOS Tahoe 26

Closes #9817 

Demo:


https://github.com/user-attachments/assets/60eaae6e-a3ff-41eb-8c86-ba700490d6e2



Note:
- Tried first a passthrough-views approach, but AppKit’s internal
toolbar subviews continued intercepting right-clicks.
- Runtime subclassing proposed by Claude also worked but was rejected as
too fragile.
- Final solution routes secondary-click events at the window level using
sendEvent(_:), forwarding them to the tab bar only when the click is
visually within its bounds.

AI Disclosure:
AI (Claude Code and Codex) assisted with early explorations, but final
implementation was developed manually after evaluating and discarding
the unsafe subclassing approach proposed by Claude.
2025-12-10 20:12:30 -08:00
Mitchell Hashimoto
76c2de6088 macos: remove the tabBarView variable we can search it 2025-12-10 20:10:54 -08:00
Lukas
969bcbe8e3 Update macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift 2025-12-10 20:03:30 -08:00
Denys Zhak
c0951ce6d8 macOS: fix tab context menu opens on macOS 26 with titlebar tabs 2025-12-10 20:03:30 -08:00
Mitchell Hashimoto
4a173052fb macos: always use overlay scroller (#9865)
With this PR, the macos scrollbar always uses the overlay style. If the
OS preferred style is `.legacy`, we flash the scroller when the mouse is
moved over it, such that users can still click and drag without relying
on scroll wheels or gestures.

Implements #9610.

There are a few lines of code that could technically be removed after
this change as they're only needed to make surfaces work correctly with
the legacy scrollbar, but I decided to leave them in since they do no
harm (see code comments). This ensures correct behavior if, for whatever
reason, some corner case brings back the legacy scrollbar, or if someone
decides to experiment with scrollbar styles in the future.
2025-12-10 13:55:49 -08:00
Daniel Wennberg
93d77ae436 Always use overlay scroller, flash when mouse moved 2025-12-10 13:33:18 -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
260e6dea59 macOS: fix theme reloading (#9360)
### Background
After #9344, the Ghostty theme won't change after switching systems',
and reverting #9344 will bring back the issue it fixed.

The reason these two issues are related is because the scheme change is
based on changes of `effectiveAppearance`, which is also affected by
setting the window's `appearance` or changing
`NSAppearance.currentDrawing()`.

### Changes
Instead of observing `effectiveAppearance`, we now explicitly update the
color scheme of surfaces, so that we can control when it happens to
avoid callback loops and redundant updates.

### Regression Tests

- [x] #8282
- [x] Reloading with `window-theme = light` should update Ghostty with
the default dark theme with a dark window theme (break before
[#83104ff](83104ff27a))
- [x] `window-theme = light \n macos-titlebar-style = native` should
update Ghostty with the default dark theme with a light window theme
- [x] Reloading from the default config to `theme=light:3024
Day,dark:3024 Night \n window-theme = light`, should update Ghostty with
the theme `3024 Day` with a light window theme (break on
[#d39cc6d](d39cc6d478))
- [x] Using `theme=light:3024 Day,dark:3024 Night`; Switching the
system's appearance should change Ghostty's appearance (break on
[#d39cc6d](d39cc6d478))
- [x] Reloading from `theme=light:3024 Day,dark:3024 Night` with a light
window theme to the default config, should update Ghostty with the
default dark theme with a dark window theme
- [x] Reloading from the default config to `theme=light:3024
Day,dark:3024 Night \n window-theme=dark`, should update Ghostty with
the theme `3024 Night` with a dark window theme
- [x] Reloading from `theme=light:3024 Day,dark:3024 Night \n
window-theme=dark` to `theme=light:3024 Day,dark:3024 Night` with light
system appearance, should update Ghostty from dark to light
- [x] Reload with quick terminal open
2025-12-10 12:56:20 -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
3ca6617a18 macos: teach agents about zig build run (#9758) 2025-12-10 12:53:06 -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
d7883fbde2 build(deps): bump peter-evans/create-pull-request from 7.0.11 to 8.0.0 (#9855)
Bumps
[peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request)
from 7.0.11 to 8.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/peter-evans/create-pull-request/releases">peter-evans/create-pull-request's
releases</a>.</em></p>
<blockquote>
<h2>Create Pull Request v8.0.0</h2>
<h2>What's new in v8</h2>
<ul>
<li>Requires <a
href="https://github.com/actions/runner/releases/tag/v2.327.1">Actions
Runner v2.327.1</a> or later if you are using a self-hosted runner for
Node 24 support.</li>
</ul>
<h2>What's Changed</h2>
<ul>
<li>chore: Update checkout action version to v6 by <a
href="https://github.com/yonas"><code>@​yonas</code></a> in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4258">peter-evans/create-pull-request#4258</a></li>
<li>Update actions/checkout references to <a
href="https://github.com/v6"><code>@​v6</code></a> in docs by <a
href="https://github.com/Copilot"><code>@​Copilot</code></a> in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4259">peter-evans/create-pull-request#4259</a></li>
<li>feat: v8 by <a
href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in
<a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4260">peter-evans/create-pull-request#4260</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/yonas"><code>@​yonas</code></a> made
their first contribution in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4258">peter-evans/create-pull-request#4258</a></li>
<li><a href="https://github.com/Copilot"><code>@​Copilot</code></a> made
their first contribution in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4259">peter-evans/create-pull-request#4259</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/peter-evans/create-pull-request/compare/v7.0.11...v8.0.0">https://github.com/peter-evans/create-pull-request/compare/v7.0.11...v8.0.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="98357b18bf"><code>98357b1</code></a>
feat: v8 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/4260">#4260</a>)</li>
<li><a
href="41c0e4b789"><code>41c0e4b</code></a>
Update actions/checkout references to <a
href="https://github.com/v6"><code>@​v6</code></a> in docs (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/4259">#4259</a>)</li>
<li><a
href="994332de4c"><code>994332d</code></a>
chore: Update checkout action version to v6 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/4258">#4258</a>)</li>
<li>See full diff in <a
href="22a9089034...98357b18bf">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=peter-evans/create-pull-request&package-manager=github_actions&previous-version=7.0.11&new-version=8.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
2025-12-10 09:23:40 -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
dependabot[bot]
5df95ba210 build(deps): bump peter-evans/create-pull-request from 7.0.11 to 8.0.0
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 7.0.11 to 8.0.0.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](22a9089034...98357b18bf)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-10 00:07:05 +00: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
Mitchell Hashimoto
50ac848672 terminal/tmux: capture both primary/alt screen 2025-12-09 13:00:40 -08:00
Mitchell Hashimoto
a3e01581be terminal/tmux: history capture clears active area 2025-12-09 11:33:06 -08:00