Commit Graph

1923 Commits (main)

Author SHA1 Message Date
davidsanchez222 0e49204b95 refactor(macos): centralize background opacity toggling across controllers 2026-04-05 17:04:20 -04:00
davidsanchez222 e5c31e8b37 macos: opacity-toggle setting persists between tabs in a window and to a newly created window 2026-04-05 17:04:20 -04:00
jamylak 355aecb6ba macos: cancel deferred tab presentation on close
The 👻 Ghost Tab Issue

Previous failure scenario (User perspective):

1. Open a new tab
2. Instantly trigger close other tabs
   (eg. through custom user keyboard shortcut)
3. Now you will see an empty Ghost Tab
   (Only a window bar with empty content)

The previous failure mode is:

1. Create a tab or window now in `newTab(...)` / `newWindow(...)`.
2. Queue its initial show/focus work with `DispatchQueue.main.async`.
3. Close that tab or window with `closeTabImmediately()` /
 `closeWindowImmediately()` before the queued callback runs.
4. The queued callback still runs anyway and calls `showWindow(...)` /
 `makeKeyAndOrderFront(...)` on stale state.
5. The tab can be resurrected as a half-closed blank ghost tab.

The fix:

- Store deferred presentation work in a cancellable
  DispatchWorkItem and cancel it from the close paths
  before AppKit finishes tearing down the tab or window.
- This prevents the stale show/focus callback from
  running after close.
2026-04-05 17:43:41 +10:00
Toby She 30fdc8f4c8 macOS: fix cannot rebind super+up and super+down 2026-04-02 22:58:19 -04:00
Lukas 18f2702225
macOS: fix Find Next/Previous button in the menu bar is not working as expected 2026-04-02 20:31:31 +02:00
Lukas 9ec5672505
Revert "macOS: close search bar if needed when it loses focus (#11980)"
This reverts commit 20cfaae2e5, reversing
changes made to 3509ccf78e.
2026-04-01 19:21:42 +02:00
Lukas 702a2b43c3
macOS: fix upper cased letter is not correctly mapped to menu shortcut 2026-04-01 14:50:53 +02:00
Mitchell Hashimoto 292bf13d06
macOS: Make version in about dialog clickable (#12007)
- Fixes: https://github.com/ghostty-org/ghostty/issues/11964

Made a private enum type `VersionConfig` to reference whether the
release is a semver or tip, makes it easier for later in the view to
`switch` between cases.

I do think there could be a better place for this enum or we can get rid
of it, open to opinions. Right now version parsing is kind of duplicated
between `AboutView` and `UpdateModalView` so we can also extract to a
common helper if wanted.

Tested by manually setting `Marketing Version` in build settings to 

`1.3.1`
<img width="412" height="532" alt="Screenshot 2026-03-30 at 18 31 15"
src="https://github.com/user-attachments/assets/285bb94d-138b-4169-bb66-684eb04b6ca3"
/>

`332b2aefc`
<img width="412" height="532" alt="Screenshot 2026-03-30 at 18 32 48"
src="https://github.com/user-attachments/assets/fea30d39-bea7-4885-8221-1696e148f45e"
/>

### AI Disclosure
I used Sonnet 4.6 to understand where the version strings came from and
in what format, it read release yml files to see what's going on. Then
it proposed really bad code so I manually went in and cleaned up the
view.
2026-03-31 06:38:59 -07:00
Lukas 591dbd5112
macOS: fix incorrect delete symbol mapping 2026-03-31 10:27:12 +02:00
Louis Qian 010880a90a chore: make url computed property & rework enum signature 2026-03-30 20:15:01 -07:00
Louis Qian 183e2cef2f chore: clean up switch statement 2026-03-30 18:51:45 -07:00
Louis Qian 90d71dd2f6 chore: clean up comments 2026-03-30 18:49:17 -07:00
Louis Qian b29f261dc8 chore: clean up versionConfig to be init-able 2026-03-30 18:44:49 -07:00
Louis Qian ed6f0588a3 feat: make version clickable depending on type 2026-03-30 18:41:26 -07:00
Lukas a06350df9b
macOS: close search bar if needed when it loses focus
This adds features like:
1. Clicking outside of SearchBar works like typing `escape`
2. Typing `tab` while search bar is focused also works like typing `escape`
2026-03-30 18:29:44 +02:00
Mitchell Hashimoto d643792f36
macOS: add keyboard shortcut test (#11986)
This is the first step (also another step forward for completing #7879)
to fix various responder issues regarding keyboard shortcuts. I tried my
best to separate changes chunk by chunk; there will follow up pr based
on this to fix them.

This pr doesn't change any existing behaviours/flaws, but following
changes will be easier to review after this.

## AI Disclosure

Claude wrote most of the test cases
2026-03-30 09:20:35 -07:00
Mitchell Hashimoto 1672e891b9
macOS: remove redundant tab event overrides (#11984)
- Revert 5540f5f249, middle click comes
out of box with native tabbing, but we override it wrong previous.
- Reverts 894e8d91ba, I check it the
commit right before it and all the way back to
ffe4afe538, right mouse down on tab bar
works well without any issue
- Add back reverted handling in #11150


https://github.com/user-attachments/assets/8660368e-05ae-45b0-aa81-6196f3434daf
2026-03-30 09:19:33 -07:00
Lukas de8139bbc3
macOS: move MenuShortcutManager to a separate file 2026-03-30 16:10:06 +02:00
Lukas 1845dd26b6
macOS: extract menu shortcut syncing into MenuShortcutManager 2026-03-30 16:09:21 +02:00
Lukas 65cd31dc79
macOS: add NormalizedMenuShortcutKeyTests 2026-03-30 15:47:07 +02:00
Lukas 5c5f645b61
macOS: support reloading temporary config for testing 2026-03-30 15:47:07 +02:00
Lukas 51cd63871d
macos: passthrough right mouse down event to TabTitleEditor if needed (#11150) 2026-03-30 12:22:54 +02:00
Lukas 5de30c0dce
Revert "macOS: fix tab context menu opens on macOS 26 with titlebar tabs (#9831)"
This reverts commit 894e8d91ba, reversing
changes made to 4a173052fb.
2026-03-30 12:09:51 +02:00
Lukas 5c5029b0c4
Revert "macos: add support for middle-click tab close for `macos-titlebar-style = tabs` (#11963)"
This reverts commit 5540f5f249, reversing
changes made to cca4c788ad.
2026-03-30 12:08:49 +02:00
Lukas 013579cfcf
macOS: fix initial focus of command palette when building with Xcode 26.4
Tip works fine, but I've tried release and debug build with Xcode 26.4, it failed to focus as expected
2026-03-30 10:03:09 +02:00
Lukas 32920b6b2a
macOS: handle surface focus more gracefully
This will fix surface focus state is not consistent with first responder state when the search bar is open
2026-03-30 10:03:09 +02:00
Nicholas Ochoa 3f6683df02 macos: add support for middle-click tab close 2026-03-29 15:19:35 -07:00
Austin Drummond 3c2c596dc7
fix global keybinds from not repsonding anymore 2026-03-28 17:35:26 -04:00
Lukas ad0c5fbec3
macOS: fix regression caused by 3ee8ef4f65 2026-03-26 19:58:18 +01:00
Lukas 95ee878904
macOS: add test case for search bar focus change 2026-03-26 19:58:18 +01:00
Lukas d80d84862e
macOS: fix mouse not working correctly in CommandPaletteView (#11658) 2026-03-19 19:26:58 +01:00
Lukas ac3893d0b9
macOS: Add command palette tests 2026-03-19 19:26:57 +01:00
Lukas 50113ab678
macOS: add mouse state tests for #11276
It will fail on 4e24adf71 and success after #11276
2026-03-19 19:02:13 +01:00
Mitchell Hashimoto f3ac604fff
macos: select tab applescript command should not activate application (#11459)
Related to #11457
2026-03-13 08:53:53 -07:00
Mitchell Hashimoto 4c4e83784c
macos: new tab applescript command should not activate application
Related to #11457
2026-03-13 08:49:22 -07:00
Lukas 5c51603b0b
chore: make ci happy 2026-03-12 20:02:23 +01:00
Lukas 07bc888682
macOS: fix window position when dragging split into a new window 2026-03-12 19:54:41 +01:00
Lukas 3022aa05ea
macOS: add test cases for drag-split 2026-03-12 19:54:12 +01:00
Lukas d6d6fe4e58
macOS: update window cascading
Make it smaller and add comparisons between y values
2026-03-12 18:58:37 +01:00
Lukas 5e3866381b
macOS: fix window cascading for the second window 2026-03-12 18:32:04 +01:00
Lukas ea262cdd34
macOS: fix window cascading for 3rd+ window 2026-03-12 18:32:04 +01:00
Lukas 77c2acf843
macOS: add test case for window cascading without moving the window 2026-03-12 18:32:04 +01:00
Lukas 08107d342a
macOS: we don't need initialFrame anymore 2026-03-12 15:42:29 +01:00
Lukas 4f849a1512
macOS: fix window position for the very first window 2026-03-12 15:42:29 +01:00
Lukas c399812036
macOS: add test case for positioning the very first window 2026-03-12 15:42:28 +01:00
Lukas d6dfaf28fe
macOS: support injecting temporary defaults when testing 2026-03-12 13:16:55 +01:00
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
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 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
Tim Culverhouse d1468086ef
macos: defer key-window focus sync to reduce churn
Amp-Thread-ID: https://ampcode.com/threads/T-019cb9fe-b11b-753f-99e7-8ecc52b73ec4
Co-authored-by: Amp <amp@ampcode.com>
2026-03-04 12:43:51 -06:00
Tim Culverhouse 3ee8ef4f65
macos: suppress split-focus click mouse reports
Amp-Thread-ID: https://ampcode.com/threads/T-019cb9fe-b11b-753f-99e7-8ecc52b73ec4
Co-authored-by: Amp <amp@ampcode.com>
2026-03-04 12:43:51 -06:00
Jon Parise a716b9c4d4 macos: Ghostty.Shell.escape unit tests 2026-03-04 11:00:03 -05:00
Mitchell Hashimoto 619e33a4fe
macos: implement audio bell support with bell-audio-path (#11154)
## Summary

This extends the macOS bell implementation to support the `audio` bell
feature, bringing it to parity with GTK/Linux.

Previously, macOS only had the `system` feature (`NSSound.beep()`). This
PR adds:

- **`audio` bell feature on macOS**: plays the file at `bell-audio-path`
using `NSSound(contentsOfFile:)`, respecting `bell-audio-volume`
- **`cval()` on the `Path` type**: allows `Path` values (a union type)
to be returned through the C API, which is needed for Swift to read
`bell-audio-path`
- **Removes `(GTK only)` restriction** from `bell-audio-path` and
`bell-audio-volume` documentation

## How it works

In `AppDelegate.swift`, when the bell rings and the `audio` feature is
enabled, Ghostty now:
1. Reads `bell-audio-path` from config
2. Loads it as an `NSSound`
3. Applies `bell-audio-volume` and plays it

Falls back gracefully if the path is not set or the file cannot be
loaded.

## Example config

```
bell-features = audio
bell-audio-path = /System/Library/Sounds/Glass.aiff
bell-audio-volume = 0.8
```

## Testing

- Set `bell-features = audio` and `bell-audio-path` to any valid audio
file
- Trigger a bell with `echo -e '\a'`
- Audio should play at the configured volume
2026-03-03 20:08:04 -08:00
Mitchell Hashimoto 98ad1d955c
use proper type for optional path 2026-03-03 19:53:15 -08:00
Alaa Ali b215291914 macos: implement audio bell support with bell-audio-path
Extends the macOS bell implementation to support the `audio` bell
feature by playing a user-specified audio file via NSSound.

Previously, macOS only supported the `system` feature (NSSound.beep()).
This change adds support for:
- `audio` bell feature: plays the file at `bell-audio-path` using
  NSSound, respecting the `bell-audio-volume` setting
- Adds `cval()` to the `Path` type so it can be returned via the C API

Also removes the "(GTK only)" restriction from `bell-audio-path` and
`bell-audio-volume` documentation, as these options now work on macOS.

Example config:
  bell-features = audio
  bell-audio-path = /System/Library/Sounds/Glass.aiff
  bell-audio-volume = 0.8
2026-03-03 23:00:50 +01:00
Lukas 4437707132
macos: use a separated struct to hide and restore tab states 2026-03-03 17:42:17 +01:00
Lukas 78fdff34a9
macos: hide close button when editing tab title 2026-03-03 17:24:56 +01:00
Lukas 661470897e
macos: passthrough right mouse down event to TabTitleEditor if needed 2026-03-03 17:24:56 +01:00
Lukas 205c05d59d
macos: passthrough mouse down event to TabTitleEditor if needed 2026-03-03 17:15:12 +01:00
Lukas e6e5f3ffe1
macos: finish editing tab title when the window resigns as key window 2026-03-03 16:34:11 +01:00
Abdurrahman 0d5b9d554c
Update macos/Sources/Features/Terminal/TerminalController.swift
apply reviewer suggestion for cascading

Co-authored-by: Lukas <134181853+bo2themax@users.noreply.github.com>
2026-02-28 18:02:40 +01:00
A-AKB 6e622f8c75 fix(macos): extract window cascade logic into helper function 2026-02-28 01:43:00 +01:00
A-AKB 0db32ab9a8 macos: fix window size/position restoration on Cmd+W close
This fixes two overlapping issues regarding window positioning and Cmd+W window closures on macOS:

1. `window-position-x` and `window-position-y` coordinates were being ignored on initial launch because `TerminalWindow.setInitialWindowPosition` depended on the `TerminalController`, which isn't fully attached during `awakeFromNib`. This logic was moved so explicit coordinates are correctly enforced.
2. When closing a window via Cmd+W (leaving the app active), reopening the window would continuously cascade down and to the right rather than restoring to the previous position. It now checks if there are other windows open before cascading.
3. `LastWindowPosition` was updated to save both the frame origin and size (width/height), ensuring that restoring a closed window correctly mimics native AppKit State Restoration size behaviors while honoring explicit configurations.
2026-02-28 01:34:18 +01:00
Lukas df53f75ad1
macOS: refine window tint for liquid glass (#11018)
Depends on #11030

- Update constraints of `TerminalGlassView`
- Use `TerminalViewContainer.DerivedConfig` to map styling properties
- Add TerminalViewContainerTests
- Instead of using delay, now the view updates are explicitly called by
window controllers
2026-02-27 10:49:12 -08:00
Jeffrey C. Ollie ea5b07d20f
core: add tests for `ghostty.h`
* ensure that `ghostty.h` compiles during basic Zig tests
* ensure that non-exhaustive enums are kept synchronized between
  `ghostty.h` and their respective Zig counterpart.
* adjust some enums that varied from established conventions
2026-02-27 09:22:23 -06:00
Lukas e55ebf0008
macos: workaround for TabTitleEditor alignment issue 2026-02-27 10:21:11 +01:00
Mitchell Hashimoto 3ee63035d3
macos: DockTilePlugin finds app bundle via `.app` suffix
Fixes #11029 (probably)

If you renamed the app bundle, the prior check would infinite loop due
to the combination of two bugs: invalid termination checks and
hardcoding "Ghostty.app"
2026-02-26 19:58:53 -08:00
Mitchell Hashimoto a5909dfa1d
macos: command finished notifications always show up 2026-02-26 13:40:41 -08:00
Joseph Martinsen f4ddddc4b7 macos: refactor command finish notification duration handling 2026-02-26 13:17:19 -08:00
Joseph Martinsen 3b5a7b77d3 macos: implement notify on command finish 2026-02-26 13:12:29 -08:00
Mitchell Hashimoto dcb7c9a4b8
macos: show the notification count number in the badge 2026-02-26 10:21:35 -08:00
Mitchell Hashimoto 5389fdfbaf
macos: lint 2026-02-26 10:14:22 -08:00
Mitchell Hashimoto 454a89e011
macos: clean up badge request state 2026-02-26 10:10:42 -08:00
Mitchell Hashimoto 3aca722415
macos: further simplication of AppDelegate bell state 2026-02-26 09:52:26 -08:00
Mitchell Hashimoto 79ca4daea6
macos: try to clean up Appdelegate combine mess 2026-02-26 09:47:17 -08:00
Mitchell Hashimoto ea8bf17df8
macos: use combine to coalesce bell values 2026-02-26 09:39:23 -08:00
Mitchell Hashimoto d05fb652ed
macos: update AGENTS.md 2026-02-26 09:10:00 -08:00
Mitchell Hashimoto c60e24d200
macos: update to Sparkle 2.9 2026-02-26 08:49:42 -08:00
Noah Bernsohn c4766dff77 fix: restore terminalTitle variable removed in previous edit 2026-02-26 07:18:06 -08:00
Noah Bernsohn 62c1d50757 Update macos/Sources/Features/Command Palette/TerminalCommandPalette.swift
Co-authored-by: Lukas <134181853+bo2themax@users.noreply.github.com>
2026-02-26 07:18:06 -08:00
Noah Bernsohn f38234bc5b apprt: show title override in command palette jump commands 2026-02-26 07:18:05 -08:00
Mitchell Hashimoto e6da439e43
macos: style changes 2026-02-26 07:09:08 -08:00
Lukas 05a125533b
macos: fix glass tinting when theme changes 2026-02-26 11:24:54 +01:00
Mitchell Hashimoto 610e1f5f47
macos: add Weak to iOS build 2026-02-25 16:03:14 -08:00
Mitchell Hashimoto 1c3f7601a7
macos: pass last focused surface as env, use for focus detection
Fixes #10935

This is a more robust way to detect "is my surface focused" because that
question usually means "is my surface the last focused surface" if a
_different_ surface is not focused. We already have used this pattern
all over but we should extend it to SwiftUI too.
2026-02-25 14:01:12 -08:00
Mitchell Hashimoto 26146f54c5
update comments 2026-02-25 09:04:20 -08:00
Mitchell Hashimoto da045d2fb3
Remove ObjCExceptionCatcher from iOS target 2026-02-25 09:00:52 -08:00
Mitchell Hashimoto 304823d560
macos: just some textual cleanup 2026-02-25 08:58:09 -08:00
Noah Gregory 58acab6c7d
Merge branch 'ghostty-org:main' into fix-tabbing-from-tab-overview 2026-02-24 20:24:18 -05:00
Noah Gregory dd4e36f921
macOS: fix crash when adding tab from tab overview 2026-02-24 18:08:45 -05:00
Mitchell Hashimoto 06084cd840
macos: various dock tile cleanups 2026-02-24 10:38:02 -08:00
Mitchell Hashimoto eaf7d8a012
macos: icon tests 2026-02-24 10:26:13 -08:00
Mitchell Hashimoto f451ea8e46
macos: move icon codable/equatable to extension 2026-02-24 10:22:49 -08:00
Lukas c72788894e
ci: fix linting and delete non-useful tests 2026-02-24 10:13:24 +01:00
Lukas f831f68f1a
macOS: update AppIcon encoding
- make `ColorizedGhosttyIcon` codable
- remove deprecated string encoding introduced in tip
2026-02-24 09:51:30 +01:00
Mitchell Hashimoto 4b1178e4f6
macos: rename a bunch of files 2026-02-24 08:58:15 +01:00
Mitchell Hashimoto 2c28c27ca5
moving lots of files, removing unused stuff 2026-02-24 08:58:15 +01:00