Commit Graph

15054 Commits

Author SHA1 Message Date
Mitchell Hashimoto
e514035519 macos: add terminals element to window and tab AppleScript classes
Expose terminal surfaces as elements on both ScriptWindow and ScriptTab,
allowing AppleScript to enumerate terminals scoped to a specific window
or tab (e.g. `terminals of window 1`, `terminals of tab 1 of window 1`).

Changes:
- Add `<element type="terminal">` to window and tab classes in Ghostty.sdef
- Add `terminals` computed property and `valueInTerminalsWithUniqueID:`
  lookup to ScriptWindow (returns all surfaces across all tabs)
- Add `terminals` computed property and `valueInTerminalsWithUniqueID:`
  lookup to ScriptTab (returns surfaces within that tab)
2026-03-06 08:06:52 -08:00
Mitchell Hashimoto
f72d41675b macos: fix AppleScript quit command being silently ignored
The application class in Ghostty.sdef was missing a responds-to
declaration for the quit command. Apple's Cocoa Scripting requires
the application class to explicitly declare it responds to quit via
handleQuitScriptCommand: for the aevtquit event to be dispatched.
2026-03-06 08:03:16 -08:00
Mitchell Hashimoto
341d8bdf75 macos: AppleScript windows/tabs
Add ScriptWindow and ScriptTab classes to expose window/tab hierarchy
to AppleScript, along with the corresponding sdef definitions.
2026-03-06 07:59:58 -08:00
Mitchell Hashimoto
d03338c1b5 macos: fix iOS build 2026-03-05 21:29:55 -08:00
Mitchell Hashimoto
547fd6f748 typos: ignore apple four char codes 2026-03-05 21:25:06 -08:00
Mitchell Hashimoto
ffe622ed30 macos: add standard application properties and commands
Add standard Cocoa scripting definitions to the AppleScript dictionary:

- Application properties: name, frontmost, version
- Standard Suite commands: exists, quit

These are backed by built-in Cocoa scripting classes (NSExistsCommand,
NSQuitCommand) and standard NSApplication KVC keys, so no Swift code
changes are needed.
2026-03-05 21:23:49 -08:00
Mitchell Hashimoto
fd5ad1f574 macos: add AppleScript commands for text input, key, and mouse events
Add five new AppleScript commands to Ghostty.sdef mirroring the existing
App Intents for terminal input:

- `input text`: send text to a terminal as if pasted
- `send key`: simulate a keyboard event with optional action and modifiers
- `send mouse button`: send a mouse button press/release event
- `send mouse position`: send a mouse cursor position event
- `send mouse scroll`: send a scroll event with precision and momentum

A shared `input action` enumeration (press/release) is used by both key
and mouse button commands. Modifier keys are passed as a comma-separated
string parameter (shift, control, option, command).
2026-03-05 21:17:34 -08:00
Mitchell Hashimoto
1742aeda50 macos: add focus and close AppleScript commands for terminals
Add two new AppleScript commands to the scripting dictionary:

- `focus terminal <terminal>` — focuses the given terminal and brings
  its window to the front.
- `close terminal <terminal>` — closes the given terminal without a
  confirmation prompt.

Each command is implemented as an NSScriptCommand subclass following
the same pattern as the existing split command.
2026-03-05 20:59:03 -08:00
Mitchell Hashimoto
ef669eeae7 macos: add AppleScript split command
Add a new `split` command to the AppleScript scripting dictionary that
splits a terminal in a given direction (right, left, down, up) and
returns the newly created terminal.

The command is exposed as:
  split terminal <terminal> direction <direction>

Also adds a `fourCharCode` String extension for converting four-character
ASCII strings to their FourCharCode (UInt32) representation.
2026-03-05 20:54:34 -08:00
Mitchell Hashimoto
40c74811f1 macos: fix perform action 2026-03-05 20:32:57 -08:00
Mitchell Hashimoto
52c0709d88 macos: add ability for agents to run debug app 2026-03-05 20:30:31 -08:00
Mitchell Hashimoto
c90a782e59 macos: implement basic read-only applescript stuff 2026-03-05 20:10:01 -08:00
Mitchell Hashimoto
291fbf55cb macos: AppleScript starting 2026-03-05 20:03:28 -08:00
Mitchell Hashimoto
055ed28580 macos: add build script, update AGENTS.md, skip UI tests (#11202)
This is an update to address common agentic issues I run into, but the
`build.nu` script may be generally helpful to people using the Nix env
since `xcodebuild` is broken by default in Nix due to the
compiler/linker overrides Nix shell does.
2026-03-05 20:03:16 -08:00
Mitchell Hashimoto
04aff46022 macos: add build script, update AGENTS.md, skip UI tests
This is an update to address common agentic issues I run into,
but the `build.nu` script may be generally helpful to people using
the Nix env since `xcodebuild` is broken by default in Nix due to the
compiler/linker overrides Nix shell does.
2026-03-05 19:55:50 -08:00
Mitchell Hashimoto
adab5f6f0e build(deps): bump docker/build-push-action from 6.19.2 to 7.0.0 (#11199)
Bumps
[docker/build-push-action](https://github.com/docker/build-push-action)
from 6.19.2 to 7.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/docker/build-push-action/releases">docker/build-push-action's
releases</a>.</em></p>
<blockquote>
<h2>v7.0.0</h2>
<ul>
<li>Node 24 as default runtime (requires <a
href="https://github.com/actions/runner/releases/tag/v2.327.1">Actions
Runner v2.327.1</a> or later) by <a
href="https://github.com/crazy-max"><code>@​crazy-max</code></a> in <a
href="https://redirect.github.com/docker/build-push-action/pull/1470">docker/build-push-action#1470</a></li>
<li>Remove deprecated <code>DOCKER_BUILD_NO_SUMMARY</code> and
<code>DOCKER_BUILD_EXPORT_RETENTION_DAYS</code> envs by <a
href="https://github.com/crazy-max"><code>@​crazy-max</code></a> in <a
href="https://redirect.github.com/docker/build-push-action/pull/1473">docker/build-push-action#1473</a></li>
<li>Remove legacy export-build tool support for build summary by <a
href="https://github.com/crazy-max"><code>@​crazy-max</code></a> in <a
href="https://redirect.github.com/docker/build-push-action/pull/1474">docker/build-push-action#1474</a></li>
<li>Switch to ESM and update config/test wiring by <a
href="https://github.com/crazy-max"><code>@​crazy-max</code></a> in <a
href="https://redirect.github.com/docker/build-push-action/pull/1466">docker/build-push-action#1466</a></li>
<li>Bump <code>@​actions/core</code> from 1.11.1 to 3.0.0 in <a
href="https://redirect.github.com/docker/build-push-action/pull/1454">docker/build-push-action#1454</a></li>
<li>Bump <code>@​docker/actions-toolkit</code> from 0.62.1 to 0.79.0 in
<a
href="https://redirect.github.com/docker/build-push-action/pull/1453">docker/build-push-action#1453</a>
<a
href="https://redirect.github.com/docker/build-push-action/pull/1472">docker/build-push-action#1472</a>
<a
href="https://redirect.github.com/docker/build-push-action/pull/1479">docker/build-push-action#1479</a></li>
<li>Bump minimatch from 3.1.2 to 3.1.5 in <a
href="https://redirect.github.com/docker/build-push-action/pull/1463">docker/build-push-action#1463</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/docker/build-push-action/compare/v6.19.2...v7.0.0">https://github.com/docker/build-push-action/compare/v6.19.2...v7.0.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d08e5c354a"><code>d08e5c3</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1479">#1479</a>
from docker/dependabot/npm_and_yarn/docker/actions-t...</li>
<li><a
href="cbd2dff9a0"><code>cbd2dff</code></a>
chore: update generated content</li>
<li><a
href="f76f51f129"><code>f76f51f</code></a>
chore(deps): Bump <code>@​docker/actions-toolkit</code> from 0.78.0 to
0.79.0</li>
<li><a
href="7d03e66b5f"><code>7d03e66</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1473">#1473</a>
from crazy-max/rm-deprecated-envs</li>
<li><a
href="98f853d923"><code>98f853d</code></a>
chore: update generated content</li>
<li><a
href="cadccf6e8c"><code>cadccf6</code></a>
remove deprecated envs</li>
<li><a
href="03fe8775e3"><code>03fe877</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1478">#1478</a>
from docker/dependabot/github_actions/docker/setup-b...</li>
<li><a
href="827e36650e"><code>827e366</code></a>
chore(deps): Bump docker/setup-buildx-action from 3 to 4</li>
<li><a
href="e25db879d0"><code>e25db87</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1474">#1474</a>
from crazy-max/rm-export-build-tool</li>
<li><a
href="1ac2573b5c"><code>1ac2573</code></a>
Merge pull request <a
href="https://redirect.github.com/docker/build-push-action/issues/1470">#1470</a>
from crazy-max/node24</li>
<li>Additional commits viewable in <a
href="10e90e3645...d08e5c354a">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=docker/build-push-action&package-manager=github_actions&previous-version=6.19.2&new-version=7.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 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>
2026-03-05 19:36:13 -08:00
dependabot[bot]
96a5e71871 build(deps): bump docker/build-push-action from 6.19.2 to 7.0.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.19.2 to 7.0.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](10e90e3645...d08e5c354a)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-06 00:14:51 +00:00
Mitchell Hashimoto
3e220ab375 Windows build fixes (#11195)
Some more fixes to get Windows building again. `zig build` on
x64_64-windows now succeeds but `zig build test` fails in
`src/terminal/page.zig` because Zig/Windows lacks a POSIX `mmap`
implementation.
2026-03-05 12:59:06 -08:00
Jeffrey C. Ollie
b1d3e36e2e windows: add GetComputerNameA so that hostname-related functions work 2026-03-05 10:03:58 -06:00
Jeffrey C. Ollie
d29e1cc137 windows: use explicit error sets to work around lack of file locking 2026-03-05 09:29:04 -06:00
Jeffrey C. Ollie
cccdb0d2ad windows: add trivial implementation of expandHome 2026-03-05 09:28:02 -06:00
Jeffrey C. Ollie
e8aad10326 windows: avoid the use of wcwidth 2026-03-05 09:26:52 -06:00
ghostty-vouch[bot]
e1f4ee7fdd Update VOUCHED list (#11192)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/11184#discussioncomment-16011801)
from @mitchellh.

Vouch: @mac0ne

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-05 14:53:00 +00:00
ghostty-vouch[bot]
f36b903479 Update VOUCHED list (#11191)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/11190#issuecomment-4005537826)
from @00-kat.

Vouch: @AnthonyZhOon

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-05 14:40:10 +00:00
Jeffrey C. Ollie
acf54a9166 windows: use new callconv convention 2026-03-05 08:26:08 -06:00
Jon Parise
42540f44cd fix: zsh shell integration when sudo and ssh aliases are defined (#11185)
I encountered an issue related to
https://github.com/ghostty-org/ghostty/discussions/8641 and
https://github.com/ghostty-org/ghostty/pull/8647, but in `zsh` instead
of `bash`.

One of my aliases is:

```bash
alias sudo='sudo '
```

Which causes following error when sourcing the zsh shell integrations:

```shell
source /usr/share/ghostty/shell-integration/zsh/ghostty-integration
/usr/share/ghostty/shell-integration/zsh/ghostty-integration:149: defining function based on alias `sudo'
/usr/share/ghostty/shell-integration/zsh/ghostty-integration:233: parse error near `()'
```
2026-03-05 09:08:21 -05:00
Leah Amelia Chen
dd575c7160 GTK: add 'move' to the drop target actions (#11182)
Fixes #11175
2026-03-05 15:27:41 +08:00
Jeffrey C. Ollie
c920a88cdc GTK: add 'move' to the drop target actions
Fixes #11175
2026-03-04 23:31:41 -06:00
Kat
0b802e7c2e i18n: add Vietnamese translation (#8912)
Adds support for the Vietnamese language
2026-03-05 05:30:59 +00:00
Mitchell Hashimoto
fe1e25f7a6 terminal: bound link regex search work with Oniguruma retry limits (#11181)
Fixes #11177

Use per-search Oniguruma match params (retry_limit_in_search) in
StringMap-backed link detection to avoid pathological backtracking hangs
on very long lines.

The units are ticks in the internal loop so its kind of opaque but this
seems to still match some very long URLs. The test case in question was
a 169K character line (which is now rejected).
2026-03-04 21:09:10 -08:00
Mitchell Hashimoto
3dde6e2559 terminal: bound link regex search work with Oniguruma retry limits
Fixes #11177

Use per-search Oniguruma match params (retry_limit_in_search) in
StringMap-backed link detection to avoid pathological backtracking hangs
on very long lines.

The units are ticks in the internal loop so its kind of opaque but
this seems to still match some very long URLs. The test case in question
was a 169K character line (which is now rejected).
2026-03-04 21:02:55 -08:00
Jeffrey C. Ollie
320d9c2f1c Fix Windows test in src/Command.zig (#11180)
This was introduced in #10611. This doesn't fix all of the current
Windows build problems, but at least fixes one that I introduced.
2026-03-04 22:50:00 -06:00
Jeffrey C. Ollie
961bf46884 Fix Windows test in src/Command.zig
This was introduced in #10611. This doesn't fix all of the current
Windows build problems, but at least fixes one that I introduced.
2026-03-04 22:35:58 -06:00
ghostty-vouch[bot]
a5327a51f3 Update VOUCHED list (#11179)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/11164#discussioncomment-16005149)
from @mitchellh.

Vouch: @Michielvk

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-05 04:34:36 +00:00
ghostty-vouch[bot]
dfa968d932 Update VOUCHED list (#11176)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/11175#issuecomment-4001807388)
from @jcollie.

Vouch: @douglas

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-05 03:07:05 +00:00
Anh Thang
e2a01beca7 Merge branch 'main' into vi_VN 2026-03-05 08:56:57 +07:00
Mitchell Hashimoto
46522a8779 gtk: +new-window now respects --working-directory and -e (#10809)
Fixes: #8862
Fixes: #10716

This adds the machinery to pass configuration settings received over
DBus down to the GObject Surface so that that configuration information
can be used to override some settings from the current "live" config
when creating a new window. Currently it's only possible to override
`--working-directory`, `--command`, and `--title`. `-e` on the `ghostty
+new-window` CLI works as well.

Adding more overridable settings is possible, but being able to fully
override any possible setting would better be served with a major revamp
of how Ghostty handles configs, which is way out of scope at the moment.
2026-03-04 15:09:58 -08:00
Mitchell Hashimoto
436a11dd59 apprt/gtk: reduce split-tree flicker by reusing leaf widgets (#11170)
Fixes #8208

Split-tree updates currently clear `tree_bin` and then wait for every
surface to become parentless before rebuilding. That leaves the split
area blank for one or more frames, which is the visible flicker during
split create/close/ resize/equalize actions.

Keep the previous widget tree attached until the idle rebuild runs, then
swap in the rebuilt tree in one step. During rebuild, reuse existing
leaf widgets by detaching and reparenting them into the new `GtkPaned`
hierarchy instead of recreating wrappers for every leaf.

This removes the parent-settling rebuild path and avoids transient blank
frames while preserving debounced rebuild behavior.
2026-03-04 15:02:04 -08:00
Mitchell Hashimoto
58d6021ec4 apprt/gtk: reduce split-tree flicker by reusing leaf widgets
Fixes #8208

Split-tree updates currently clear `tree_bin` and then wait for every surface
to become parentless before rebuilding. That leaves the split area blank for
one or more frames, which is the visible flicker during split create/close/
resize/equalize actions.

Keep the previous widget tree attached until the idle rebuild runs, then
swap in the rebuilt tree in one step. During rebuild, reuse existing
leaf widgets by detaching and reparenting them into the new `GtkPaned` 
hierarchy instead of recreating wrappers for every leaf.

This removes the parent-settling rebuild path and avoids transient blank
frames while preserving debounced rebuild behavior.
2026-03-04 14:56:51 -08:00
Jeffrey C. Ollie
5bc5820f32 gtk: simplify new-window action memory management with an arena 2026-03-04 16:01:12 -06:00
Mitchell Hashimoto
2cfc9d36d8 Revert "build: link to the system FontConfig by default (#11169)
This reverts commit ee4c6f88c5.

This breaks standard `zig build run` from a dev shell in Nix/NixOS. I
think we need to rethink some of the protections here, possibly only to
apply to packaging/release modes or something.

cc @jcollie
2026-03-04 13:47:48 -08:00
Mitchell Hashimoto
57d877a0d6 Revert "build: link to the system FontConfig by default on non-macOS systems"
This reverts commit 89f9dd7848.
2026-03-04 13:45:41 -08:00
Mitchell Hashimoto
05807f0d72 Revert "build: link to the system FontConfig by default on non-macOS systems (#11152)"
This reverts commit ee4c6f88c5.
2026-03-04 13:44:05 -08:00
Jeffrey C. Ollie
e27956fdde gtk: remove modifications to the core for overrides 2026-03-04 14:04:07 -06:00
Jeffrey C. Ollie
002a6cc765 gtk: use simpler method for passing overrides around
As discussed in Discord, this commit drops the `ConfigOverride` object
in favor of a simpler method of passing the overrides around. Completely
avoiding changes to the core wasn't possible but it's very minimal now.
2026-03-04 14:04:07 -06:00
Jeffrey C. Ollie
f2ce7c348e gtk: +new-window document --title 2026-03-04 14:04:07 -06:00
Jeffrey C. Ollie
ec0f9ef416 gtk: +new-window now respects --title 2026-03-04 14:04:07 -06:00
Jeffrey C. Ollie
6961c2265e gtk: +new-window now respects --working-directory and -e
Fixes: #8862
Fixes: #10716

This adds the machinery to pass configuration settings received over
DBus down to the GObject Surface so that that configuration information
can be used to override some settings from the current "live" config
when creating a new window. Currently it's only possible to override
`--working-directory` and `--command`. `-e` on the `ghostty +new-window`
CLI works as well.

Adding more overridable settings is possible, but being able to fully
override any possible setting would better be served with a major
revamp of how Ghostty handles configs, which I is way out of scope at
the moment.
2026-03-04 14:04:06 -06:00
Mitchell Hashimoto
c3febabd28 apprt: unify split-click focus behavior across macOS and GTK; suppress focus-transfer mouse events (#11167)
## Summary

This PR aligns split-pane click behavior across macOS and GTK when focus
changes due to click.

When a left-click is used to transfer focus (window activation or
switching to another split), Ghostty now treats that click as focus-only
and suppresses forwarding mouse press/release events for that
focus-transfer click.

## Changes

1. macOS: suppress focus-transfer left mouse-down and matching mouse-up
in `SurfaceView_AppKit.swift`.
1. GTK: suppress focus-transfer left mouse-down and matching mouse-up in
`src/apprt/gtk/class/surface.zig`.
1. macOS: defer key-window focus sync to next runloop tick to reduce
transient focus churn in `BaseTerminalController.swift`.
1. macOS build/lint: exclude generated/dependency paths from SwiftLint
during build in `.swiftlint.yml` and
`Ghostty.xcodeproj/project.pbxproj`.

## Behavior

1. Focus-transfer split clicks are now focus-only on both macOS and GTK.
1. Matching release is also suppressed for those clicks, avoiding
release-without-press sequences.
1. Platform behavior is consistent for split focus transitions.

## Validation

1. Built macOS target with `xcodebuild -target Ghostty -configuration
Debug -arch arm64`.
1. Ran targeted Zig test command `zig build test
-Dtest-filter=computeFraction`.
1. Ran format/lint for touched files (`swiftlint lint --fix`, `zig
fmt`).
4. Build and (human) tested click scenarios on macOS

## AI Disclosure

AI-assisted.

Thread:
https://ampcode.com/threads/T-019cb9fe-b11b-753f-99e7-8ecc52b73ec4
2026-03-04 11:11:36 -08:00
Mitchell Hashimoto
226d0b9918 zsh: fix extra newlines with leading-newline prompts (#11166)
In our multiline prompt logic, skip the newline immediately after the
first mark to avoid introducing a double newline due to OSC 133;A's
fresh-line behavior.

Fixes: #11003
2026-03-04 11:09:10 -08:00