Commit Graph

1777 Commits

Author SHA1 Message Date
Mitchell Hashimoto
ab269e2c79 config: add progress-style option (#11289)
Adds progress-style config to control OSC 9;4 progress bar visibility.
Defaults to true, set false to hide.

Fixes #11241

AI Disclosure: Claude Code (Opus 4.6) used for codebase exploration,
code review, and testing assistance. All code written and reviewed by
hand.
2026-03-11 20:46:59 -07:00
Mitchell Hashimoto
8093695055 macos: only run key equivalents for Ghostty-owned menu items
Fixes #11396

Track menu items populated from Ghostty keybind actions and only trigger
those from SurfaceView performKeyEquivalent. This avoids app-default
shortcuts such as Hide from pre-empting explicit keybinds.
2026-03-11 19:59:56 -07:00
Michal Olechowski
84d48d1c6a config: add progress-style option
Add option to disable OSC 9;4 ConEmu progress bars via config.

Fixes #11241
2026-03-12 01:33:25 +01:00
Mitchell Hashimoto
fe98f3884d macos: only show split grab handle when the mouse is near it
Fixes #11379

For this pass, I made it a very simple "within 20%" (height-wise) of the
split handle. There is no horizontal component. I want to find the right
balance between always visible (today mostly) to only visible on direct
hover, because I think it'll be too hard to discover on that far right
side.
2026-03-11 10:48:09 -07:00
Mitchell Hashimoto
19e5053b28 macos: only show the grab handle in fullscreen if there are splits (#11381)
Fixes #11376
2026-03-11 10:08:25 -07:00
Mitchell Hashimoto
12bc1e7860 macos: only show the grab handle in fullscreen if there are splits
Fixes #11376
2026-03-11 10:02:09 -07:00
Lukas
596d502a75 macOS: restore window frame under certain conditions 2026-03-11 17:45:10 +01:00
Lukas
45d360dc68 macOS: set the initial window position after window is loaded 2026-03-11 17:45:09 +01:00
Lukas
e8c82ca1af macOS: save frame only if the window is visible 2026-03-11 17:45:09 +01:00
Lukas
0af9938ad2 macos: add UI test for window position restore across titlebar styles
Tests that window position and size are correctly restored after
reopen for all four macos-titlebar-style variants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:45:09 +01:00
Mitchell Hashimoto
86c2a2e87f input: add direct set_surface_title and set_tab_title actions
Fixes #11316

This mirrors the `prompt` actions (hence why there is no window action
here) and enables setting titles via keybind actions which importantly
lets this work via command palettes, App Intents, AppleScript, etc.
2026-03-11 09:25:08 -07:00
ydah
c2206542d3 macos: fix tab title rename hit testing and focus handling in fullscreen mode 2026-03-11 07:24:49 -07:00
Mitchell Hashimoto
6dd5b856b0 macos: disable Tahoe one-time codes
This disables all the automatic one-time code inputs in Ghostty.
It'd be really neat to actually dynamically change this (not sure if its
possible with NSTextContext or how often thats cached) but for now we
should just fully disable it.
2026-03-10 19:41:22 -07:00
Lukas
90dc4315e2 macos: add test cases for Ghostty.Config properties
Test boolean, string, enum, and numeric config properties using
TemporaryConfig to verify defaults and parsed values.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-10 20:03:17 +01:00
Lukas
32934445cf macos: add TemporaryConfig for AI to write test cases 2026-03-10 19:45:52 +01:00
Mitchell Hashimoto
71f81527ad macos: remove IntrinsicSizeTimingTests temporarily
These were too flaky.
2026-03-10 11:08:47 -07:00
Mitchell Hashimoto
f88b42ad39 macos: add enum type for macos-titlebar-style (#11262) 2026-03-10 10:58:47 -07:00
Mitchell Hashimoto
c06ede5849 macos: make paste_from_clipboard performable on macos (#11328)
Fixes #10751
2026-03-10 10:31:22 -07:00
Mitchell Hashimoto
aaad43c235 macos: make paste_from_clipboard performable on macos
Fixes #10751
2026-03-10 10:25:14 -07:00
Selman Kayrancioglu
6092c299d5 macos: reset mouse state on focus loss to prevent phantom drag
Fixes phantom mouse drag/selection when switching splits or apps.
The suppressNextLeftMouseUp flag and core mouse click_state were not
being reset on focus transitions, causing stale state that led to
unexpected drag behavior.

- Reset suppressNextLeftMouseUp in focusDidChange when losing focus
- Defensively reset the flag when processing normal clicks
- Reset core mouse.click_state and left_click_count on focus loss
2026-03-10 09:54:08 -07:00
Lukas
de0f2ab22d macos: add enum type for macos-titlebar-style 2026-03-10 17:15:14 +01:00
Mitchell Hashimoto
3782d118e1 macOS: restore keyboard focus after inline tab title edit (#11320)
## Summary

- After finishing an inline tab title edit (via keybind or
double-click), all keyboard input is lost because
`TabTitleEditor.finishEditing()` sets `makeFirstResponder(nil)`, leaving
the window itself as first responder with no path back to the terminal
surface.
- Adds a `tabTitleEditorDidFinishEditing` delegate callback to
`TabTitleEditorDelegate` that fires after every edit (commit or cancel).
- `TerminalWindow` implements it by calling
`makeFirstResponder(focusedSurface)` to restore keyboard focus to the
terminal.

Fixes https://github.com/ghostty-org/ghostty/discussions/11315

## Testing

- [x] Bind `prompt_tab_title` to a keybind (e.g. `keybind =
cmd+shift+i=prompt_tab_title`)
- [x] Trigger inline tab title edit via keybind, press Enter — verify
keyboard input works immediately
- [x] Trigger inline tab title edit via keybind, press Escape — verify
keyboard input works immediately
- [x] Double-click a tab title, press Enter — verify keyboard input
works immediately
- [x] Double-click a tab title, press Escape — verify keyboard input
works immediately
- [x] Verify Cmd+number tab switching works after all of the above
- [x] Verify split pane focus is correct after editing tab title with
splits open

AI disclosure: Codebase exploration and review via [Claude
Code](https://claude.com/claude-code)
2026-03-10 08:59:51 -07:00
chronologos
7629130fb4 macOS: restore keyboard focus after inline tab title edit
After finishing an inline tab title edit (via keybind or double-click),
`TabTitleEditor.finishEditing()` calls `makeFirstResponder(nil)` to
clear focus from the text field, leaving the window itself as first
responder. No code path restores focus to the terminal surface, so all
keyboard input is lost until the user clicks into a pane.

Add a `tabTitleEditorDidFinishEditing` delegate callback that fires
after every edit (commit or cancel). TerminalWindow implements it by
calling `makeFirstResponder(focusedSurface)` to hand focus back to the
terminal.

Fixes https://github.com/ghostty-org/ghostty/discussions/11315

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-10 08:52:00 -07:00
Lukas
a6cd1b08af macOS: fix intrinsicContentSize race in windowDidLoad (#11256)
Add initialContentSize fallback on TerminalViewContainer so
intrinsicContentSize returns the correct value immediately,
without waiting for @FocusedValue to propagate. This removes
the need for the DispatchQueue.main.asyncAfter 40ms delay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 15:35:49 +01:00
Lukas
cfedda1a0e macOS: add regression tests for intrinsicContentSize race (#11256)
Tests that validate intrinsicContentSize returns a correct value when
TerminalController.windowDidLoad() reads it. Currently fail, proving
the race condition where @FocusedValue hasn't propagated
lastFocusedSurface before the 40ms timer fires.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 15:27:38 +01:00
Mitchell Hashimoto
a6ee1fb292 macos: increase window-width/height apply delay from 10ms to 40ms
Band-aid for #10304

We don't have a robust fix yet but this should help mitigate more
scenarios.
2026-03-09 08:42:07 -07:00
Mitchell Hashimoto
dd3d72c3de Revert "macOS: filter proper intrinsicContentSize when opening new window (#11257)"
This reverts commit 3445c9afda, reversing
changes made to 1e981f858a.
2026-03-09 08:33:24 -07:00
Lukas
3c93c35869 macOS: filter proper intrinsicContentSize when opening new window
Fixes #11256
2026-03-09 08:21:29 -07:00
Mitchell Hashimoto
233fb12081 macos: add AppleScript front window and focused terminal properties
This adds two new propeties to make it easy to get the frontmost (main)
window and the focused terminal within a tab. We already had a property
to get the selected tab of a tab group.
2026-03-08 20:00:21 -07:00
Lukas
df4d9bc0d0 macos: fix quick terminal glassy background 2026-03-08 15:22:37 +01:00
Mitchell Hashimoto
ed9a6cb648 macos: implement the quit command 2026-03-07 07:29:40 -08:00
Mitchell Hashimoto
210b01ad60 macos: use direct parameters for object-targeting commands
Change split, focus, close, activate window, select tab, close tab, and
close window commands to accept their target object as a direct parameter
instead of a named parameter. This produces natural AppleScript syntax:

  activate window (window 1)
  close tab (tab 1 of window 1)
  split (terminal 1) direction right

instead of the awkward redundant form:

  activate window window (window 1)
  close tab tab (tab 1 of window 1)
  split terminal (terminal 1) direction right

The implementation moves command logic from NSScriptCommand subclasses
into responds-to handler methods on ScriptTerminal, ScriptWindow, and
ScriptTab, which is the standard Cocoa Scripting pattern for commands
whose direct parameter is an application class.
2026-03-07 07:23:59 -08:00
Mitchell Hashimoto
038ebef16c address some PR feedback 2026-03-07 07:07:10 -08:00
Mitchell Hashimoto
259a41d503 macos: rename surface config working directory to not be ambiguous 2026-03-06 15:16:03 -08:00
Mitchell Hashimoto
221a1639af swiftlint 2026-03-06 15:07:04 -08:00
Mitchell Hashimoto
25fa58143e macos: add macos-applescript config 2026-03-06 15:04:20 -08:00
Mitchell Hashimoto
28b4e2495d macos: Add AppleScript commands for window and tab control
Add scripting dictionary commands for activating windows, selecting tabs,
closing tabs, and closing windows.

Implement the corresponding Cocoa AppleScript command handlers and expose
minimal ScriptWindow/ScriptTab helpers needed to resolve live targets.

Verified by building Ghostty and running osascript commands against the
absolute Debug app path to exercise all four new commands.
2026-03-06 14:35:31 -08:00
Mitchell Hashimoto
d271c8ccaa macos: add new tab command 2026-03-06 12:55:43 -08:00
Mitchell Hashimoto
4d5de702f2 macos: allow split command surface configuration 2026-03-06 12:35:01 -08:00
Mitchell Hashimoto
459eaa2640 macos: order AppleScript dictionary definitions
Document the preferred Ghostty.sdef top-level order in AGENTS.md and reorder 
Ghostty Suite definitions to classes, records, enums, then commands.
2026-03-06 12:28:02 -08:00
Mitchell Hashimoto
a3adeb0166 macos: use value-style AppleScript surface configuration records
Add a `surface configuration` record type to the scripting dictionary,
implement `new surface configuration` (with optional copy-from), and allow
`new window` to accept `with configuration`.
2026-03-06 12:16:40 -08:00
Mitchell Hashimoto
959c2f51ac macos: add AppleScript new window command
Add a `new window` command to the scripting dictionary and wire it to
`NSApplication` so AppleScript can create Ghostty windows.

The command returns a scripting `window` object for the created window,
with a fallback to a direct wrapper when AppKit window ordering has not
yet refreshed in the current run loop.
2026-03-06 08:38:51 -08:00
Mitchell Hashimoto
122d0ecdfd macos: expose name (title) on window, tab, and terminal via AppleScript
Add a `name` property (code `pnam`, cocoa key `title`) to the window, tab,
and terminal classes in the scripting definition. This follows the standard
Cocoa scripting convention where `name`/`pnam` maps to the `title` KVC key,
matching what Apple does in CocoaStandard.sdef for NSWindow.

Also fixes the pre-existing terminal `title` property which used a custom
four-char code (`Gttl`) that AppleScript could not resolve directly — only
via `properties of terminal`. All three classes now use the standard `pnam`
code so `name of window 1`, `name of tab 1 of window 1`, and
`name of terminal 1` all work correctly.
2026-03-06 08:13:49 -08:00
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
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