Commit Graph

1923 Commits (main)

Author SHA1 Message Date
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
Lukas a79557f521
macOS: stop cycling icons when AboutWindow is closed
and start cycling with current icon
2026-02-24 08:58:15 +01:00
Lukas 45525a0a85
macOS: use `NSDockTilePlugIn` to update app icons 2026-02-24 08:58:14 +01:00
Martin Emde 40e6a6dd58 Refine spacing and header usage
This is 4pt header space, 12pt clickable frame height
2026-02-23 12:04:07 -08:00
Martin Emde 2842b18a3f Only show drag handle on hovered surface 2026-02-23 12:04:07 -08:00
Martin Emde 47577c7623 Make top visual space for surface drag handles 2026-02-23 12:03:45 -08:00
Mitchell Hashimoto 6a9a21afb6
macOS: Add inactive window tint overlay for liquid glass (#10943)
**Summary:**
- Add tint overlay to dim terminal windows when inactive, fixes
https://github.com/ghostty-org/ghostty/discussions/10040
- Refactor the liquid glass effect into a dedicated `TerminalGlassView`
class

Note: The tint overlay color and opacity values may not be ideal —
feedback is welcome.

**AI Disclosure:** I used Claude Code to read the macos repo and
understand the liquid glass implementation. Implemented basic tint
overlay mainly by hand. Refactor the code and review changes with Claude
Code.
2026-02-23 09:01:25 -08:00
Mitchell Hashimoto 51f304e9a0
macos: add AGENTS.md 2026-02-23 08:46:10 -08:00
Mitchell Hashimoto f5e2561eb7
macos: rename to TabTitleEditor 2026-02-23 08:38:10 -08:00
Mitchell Hashimoto b6a9d54e98
macos: extract inline title editing to standalone file 2026-02-23 08:38:09 -08:00
MiUPa 879d7cf337 macOS: remove dead tab title edit helper 2026-02-23 08:38:09 -08:00
MiUPa 368e190a41 macOS: defer inline tab rename start to reduce flicker 2026-02-23 08:38:09 -08:00
MiUPa f6e9b19fd5 macOS: widen inline tab title editor 2026-02-23 08:38:09 -08:00
MiUPa feee4443da macOS: add inline tab title editing 2026-02-23 08:38:09 -08:00
MiUPa daa2a9d0d5 macos: allow renaming tab title on double-click 2026-02-23 08:38:09 -08:00
miracles 81c9c81ae3 Refactor glass effect into TerminalGlassView and add inactive window tint overlay 2026-02-22 21:58:33 -08:00
Jon Parise dd29617cd3 macos: swiftlint 'multiple_closures_with_trailing_closure' rule
Also, re-enable the 'force_cast' rule, which was addressed earlier.
2026-02-21 10:17:15 -08:00
Tristan Partin 407b3c082f macos: fix new tab crash
It was introduced in 2a81d8cd2910b12fe007f0bc5fb5d6be57f0f0fe[0]. We
lost the subview. prefix of from the contains() call.

Co-authored-by: Brent Schroeter <github@brentsch.com>
Fixes: https://github.com/ghostty-org/ghostty/issues/10923
Link: 2a81d8cd29 [0]
2026-02-21 09:08:04 -06:00
Mitchell Hashimoto 2a81d8cd29
macos: swiftlint 'for_where' rule (#10909) 2026-02-20 21:06:47 -08:00
Mitchell Hashimoto ce46caeacb
macos: swiftlint 'switch_case_alignment' rule (#10908) 2026-02-20 21:02:46 -08:00
Mitchell Hashimoto 6ec8744b16
macOS: expand tilde in file paths before opening (#10863)
## Summary

Cmd-clicking a file path containing `~` (e.g. `~/Documents/file.txt`)
fails to open the file on macOS because `URL(filePath:)` treats `~` as a
literal directory name rather than the user's home directory.

This uses `NSString.expandingTildeInPath` to resolve `~` before
constructing the file URL.

## Root Cause

In `openURL()`, when the URL string has no scheme it falls through to:

```swift
url = URL(filePath: action.url)
```

Swift's `URL(filePath:)` does not perform tilde expansion. A path like
`~/Documents/file.txt` produces a URL pointing to a non-existent file,
and `NSWorkspace.open` silently fails.

## Fix

```swift
let expandedPath = NSString(string: action.url).expandingTildeInPath
url = URL(filePath: expandedPath)
```

## Reproduction

1. Have a terminal application (e.g. Claude Code) that outputs file
paths with `~` prefixes
2. Cmd-click the path in Ghostty on macOS
3. The file does not open (fails silently)

With this fix, the path resolves correctly and opens in the default
editor.
2026-02-20 20:56:27 -08:00
Alex Feijoo b65261eb66 macOS: expand tilde in file paths before opening
`URL(filePath:)` treats `~` as a literal directory name, so
cmd-clicking a path like `~/Documents/file.txt` would fail to
open because the resulting file URL doesn't point to a real file.

Use `NSString.expandingTildeInPath` to resolve `~` to the user's
home directory before constructing the file URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:37:54 -08:00
Jon Parise 2d6fa92d78 macos: swiftlint 'for_where' rule 2026-02-20 19:42:48 -05:00
Jon Parise f7e6639c43 macos: swiftlint 'switch_case_alignment' rule 2026-02-20 19:18:40 -05:00
Mitchell Hashimoto 5db9f03f62
macos: swiftlint 'no_fallthrough_only' rule (#10899)
This rule is generally trying to be helpful, but it doesn't like a few
places in our code base where we're intentionally listing out all of the
well-known cases. Given that, just disable it.

https://realm.github.io/SwiftLint/no_fallthrough_only.html
2026-02-20 13:39:31 -08:00
Mitchell Hashimoto 2ed341495f
macos: optimize secure input overlay animation (#10903)
Addresses discussion in #3729 and issues relating to #7333, #9590, and
#9617.

Rendering the Secure Keyboard Input overlay using innerShadow() can
strain the resources of the main thread, leading to elevated CPU load
and in some cases extended disruptions to the main thread's
DispatchQueue that result in lag or frozen frames. This change achieves
the same animated visual effect with ~35% lower CPU usage and resolves
most or all of the terminal rendering issues associated with the
overlay.
2026-02-20 13:39:14 -08:00
Jon Parise 3d3ea3fa59 macos: swiftlint 'no_fallthrough_only' rule
This rule is generally trying to be helpful, but it doesn't like a few
places in our code base where we're intentionally listing out all of the
well-known cases. Given that, just disable it.

https://realm.github.io/SwiftLint/no_fallthrough_only.html
2026-02-20 13:01:30 -05:00
Mitchell Hashimoto 3ba6d8174d
macos: swiftlint 'unused_enumerated' rule (#10888) 2026-02-20 09:43:38 -08:00
Mitchell Hashimoto 6ca80091c5
macos: add root-level .swiftlint.yml (#10890)
In order to support running from both the repository root and from
within Xcode project, and to keep things generally organized, our
primary .swiftlint.yml configuration file lives under macos/.

This change introduces a root-level .swiftlint.yml which limits the file
scope to macos/ and then includes macos/.swiftlint.yml for the rest of
the directives.

This unlocks a few benefits:

- We no longer need to pass an explicit `macos` path argument in any of
our invocations. SwiftLint will do the right thing when run either from
the repository root or from within the macos/ directory.
- It lets us easily exclude the macos/build/ directory (and re-enable
the 'deployment_target' rule). In the previous setup, this was more
challenging than you'd expect due to SwiftLint's path resolution rules
and required passing even more arguments like `--working-directory`.

The only downside is adding a new file to the repository root, but that
feels like the right trade-off given the benefits and conveniences.
2026-02-20 09:43:13 -08:00
Jon Parise 454d53e264 macos: ignore swiftlint 'line_length' rule
Also, there are no more outstanding 'mark' issues.
2026-02-20 10:35:10 -05:00
Jon Parise c2eab3b43d macos: add root-level .swiftlint.yml
In order to support running from both the repository root and from
within Xcode project, and to keep things generally organized, our
primary .swiftlint.yml configuration file lives under macos/.

This change introduces a root-level .swiftlint.yml which limits the file
scope to macos/ and then includes macos/.swiftlint.yml for the rest of
the directives.

This unlocks a few benefits:

- We no longer need to pass an explicit `macos` path argument in any of
  our invocations. SwiftLint will do the right thing when run either
  from the repository root or from within the macos/ directory.
- It lets us easily exclude the macos/build/ directory (and re-enable
  the 'deployment_target' rule). In the previous setup, this was more
  challenging than you'd expect due to SwiftLint's path resolution rules
  and required passing even more arguments like `--working-directory`.

The only downside is adding a new file to the repository root, but that
feels like the right trade-off given the benefits and conveniences.
2026-02-20 09:21:04 -05:00
Jon Parise e887527e59 macos: swiftlint 'unused_enumerated' rule 2026-02-20 08:03:05 -05:00
Brent Schroeter 7e90e26ae1 macos: optimize secure input overlay animation
Rendering the Secure Keyboard Input overlay using
innerShadow() can strain the resources of the main
thread, leading to elevated CPU load and in some
cases extended disruptions to the main thread's
DispatchQueue that result in lag or frozen frames.

This change achieves the same animated visual
effect with ~35% lower CPU usage and resolves most
or all of the terminal rendering issues associated
with the overlay.
2026-02-19 22:03:54 -08:00
Jon Parise dbf2e0e087 macos: swiftlint 'vertical_parameter_alignment' rule 2026-02-19 19:11:36 -05:00
Jon Parise c418e4b581 macos: swiftlint 'unused_optional_binding' rule 2026-02-19 19:10:38 -05:00
Jon Parise a7719a8db6 macos: swiftlint 'shorthand_operator' rule 2026-02-19 19:07:29 -05:00
Jon Parise 9bae26ab45 macos: swiftlint 'orphaned_doc_comment' rule 2026-02-19 19:06:09 -05:00
Jon Parise f4d70df34c macos: swiftlint 'implicit_getter' rule 2026-02-19 19:02:49 -05:00
Jon Parise 629a656e53 macos: swiftlint 'vertical_whitespace' rule 2026-02-19 18:58:28 -05:00
Jon Parise a36d2f5420 macos: swiftlint 'unused_closure_parameter' rule 2026-02-19 18:57:43 -05:00
Jon Parise 540adb0da3 macos: swiftlint 'unneeded_synthesized_initializer' rule 2026-02-19 18:57:19 -05:00
Jon Parise b532cd55d6 macos: swiftlint 'trailing_whitespace' rule 2026-02-19 18:56:43 -05:00
Jon Parise 33dce8511e macos: swiftlint 'trailing_semicolon' rule 2026-02-19 18:56:25 -05:00
Jon Parise 6af959920e macos: swiftlint 'syntactic_sugar' rule 2026-02-19 18:56:07 -05:00
Jon Parise 25b38b291e macos: swiftlint 'private_over_fileprivate' rule 2026-02-19 18:55:12 -05:00
Jon Parise 6052f664cf macos: swiftlint 'opening_brace' rule 2026-02-19 18:53:13 -05:00
Jon Parise b10dcc9629 macos: swiftlint 'legacy_constructor' rule 2026-02-19 18:43:22 -05:00
Jon Parise 32e540c248 macos: swiftlint 'legacy_constant' rule 2026-02-19 18:38:32 -05:00
Jon Parise 9287a61920 macos: swiftlint 'implicit_optional_initialization' rule 2026-02-19 18:36:38 -05:00
Jon Parise a83c8f8a9d macos: swiftlint 'empty_parentheses_with_trailing_closure' rule 2026-02-19 18:35:40 -05:00
Jon Parise 1b827e3e45 macos: swiftlint 'empty_enum_arguments' rule 2026-02-19 18:35:17 -05:00
Jon Parise 56d67ce88f macos: swiftlint 'control_statement' rule 2026-02-19 18:34:37 -05:00
Jon Parise a8903c1bb1 macos: swiftlint 'comment_spacing' rule 2026-02-19 18:34:02 -05:00
Jon Parise 6ade5df799 macos: swiftlint 'comma' rule 2026-02-19 18:33:34 -05:00
Jon Parise 786bad9774 macos: swiftlint 'colon' rule 2026-02-19 18:32:44 -05:00
benodiwal 3d0da44e15 feat(config): allow fullscreen config to specify non-native mode directly
Co-Authored-By: Sachin <sachinbeniwal0101@gmail.com>
2026-02-19 14:34:22 -08:00
Jon Parise 21ea94610a macos: lint Swift files using SwiftLint
SwiftLint <https://realm.github.io/SwiftLint/> is both a linter and
formatting. It's a popular way to spot issues and enforce a consistent
style.

Our SwiftLint configuration lives in macos/.swiftlint.yml, where is is
automatically discovered. It's very configurable, and I made an initial
pass as some basic, weakly-opinionated rules. The "TODO" section lists
rules that currently have violations but can be easily (auto)fixed in
follow-up commits.

Our integration is CLI-based. Similar to our other support tools, we
expect developers to install `swiftlint` via nix or e.g. Homebrew.
This is documented in HACKING.md.

We also have an optional Xcode integration, for in-editor feedback. When
`swiftlint` is available, it's run as a script-based Build Phase.

SwiftLint supports an auto-fix mode (--fix). Agents are aware of this
via AGENTS.md.

The rules are enforced using a (nix-based) CI job.
2026-02-19 14:42:11 -05:00
Jon Parise 303c9142dc macos: improve "Set Default Terminal"
Switch to using the existing UTType.unixExecutable constant for this
operator, which also lets us remove a failure path. Also, use the
completion-based setDefaultApplication() variant to handle errors.

This simplifies the code enough that we don't need the additional
NSWorkspace+Ghostty extension functions.
2026-02-18 11:47:30 -05:00
Mitchell Hashimoto e1f20739d0
add "Set Ghostty as Default Terminal App" on macOS (#10810)
This PR enables iTerm2-like one button "Set Ghostty as Default Terminal
App" functionality on macOS, making it easier to open a directory in
Ghostty, run shell scripts when mouse clicking, etc.
2026-02-17 21:04:55 -08:00
Mahno Kropotkinvich aee80d208d add "Set Ghostty as Default Terminal App" on macOS 2026-02-17 20:52:49 -08:00
Pieter Ouwerkerk ce66bea581
Move MockView to SplitTreeTests itself 2026-02-17 09:37:02 -08:00
Pieter Ouwerkerk 8fdedbce45
Add MockView and SplitTreeTests 2026-02-16 20:23:48 -08:00
Mitchell Hashimoto b358705b65
macos: rename shellQuoted() to Ghostty.Shell.quote() (#10765)
We already had an established Ghostty.Shell namespace (previously a
struct; now a more idiomatic enum), and locating these functions next to
each other makes it clearer how they relate to one another.
2026-02-16 12:40:13 -08:00
Jon Parise df6feba417 macos: rename shellQuoted() to Ghostty.Shell.quote()
We already had an established Ghostty.Shell namespace (previously a
struct; now a more idiomatic enum), and locating these functions next to
each other makes it clearer how they relate to one another.
2026-02-16 15:27:57 -05:00
Jon Parise d49ac65b16 macos: sort INFOPLIST_KEY_ names
Xcode wants these to be sorted and will update this list when the
project file is saved so proactively make this change before it gets
mixed up in other work.
2026-02-16 15:25:53 -05:00
Mitchell Hashimoto 99e342717b
fix: copy_title_to_clipboard respects user-overridden title (#10694)
## Summary
- Fixes #10345 — `copy_title_to_clipboard` now copies the user-set
custom title instead of the raw terminal title
- Adds a new `copy_title` apprt action as [suggested by
@mitchellh](https://github.com/ghostty-org/ghostty/issues/10345#issuecomment-2601002974)
- Each platform (GTK + macOS) resolves the effective title (user
override → terminal title fallback) before copying to clipboard

## Changes
- **`src/apprt/action.zig`** — New `copy_title` void action
- **`include/ghostty.h`** — C ABI enum entry
- **`src/Surface.zig`** — Binding handler now dispatches apprt action
instead of inline logic
- **`src/apprt/gtk/class/surface.zig`** — `getEffectiveTitle()` helper
(returns `title_override orelse title`)
- **`src/apprt/gtk/class/application.zig`** — GTK action handler
- **`macos/.../Ghostty.App.swift`** — macOS handler using
`surfaceView.title` + `NSPasteboard`

*Note*: This PR was *AI* assisted.
2026-02-16 11:10:17 -08:00
Noah Bernsohn 951cf13d7e macOS: show keyboard shortcuts in command palette 2026-02-15 10:17:01 -06:00
Priyanshu de49b7f27b rename copy_title action to copy_title_to_clipboard 2026-02-13 09:59:02 +05:30
Priyanshu b4be13ed50 fix: copy_title_to_clipboard now respects user-overridden title
When a user renames a surface via "Change Terminal Title" and then
uses copy_title_to_clipboard, the raw terminal title was copied
instead of the custom name.

This adds a new `copy_title` apprt action so each platform resolves
the effective title (user override or terminal-set) before copying
to clipboard.

Fixes #10345
2026-02-13 01:19:15 +05:30
Jon Parise a9e79ae74f
macos: quote input strings used for shell commands (#10583)
When we're building an input string that's explicitly meant to be used
as a shell command, quote it using the same logic as Python's
`shlex.quote` function.

This specifically addresses issues we've seen when open(1)'ing Ghostty
with filename arguments that contain spaces.

See #2633, #3030
2026-02-05 09:45:00 -05:00
Jon Parise 1ff0dd821f macos: quote input strings used for shell commands
When we're building an input string that's explicitly meant to be used
as a shell command, quote (escape) it using the same logic as Python's
shlex.quote function.

This specifically addresses issues we've seen when open(1)'ing Ghostty
with filename arguments that contain spaces.
2026-02-05 09:21:37 -05:00
Bug-Reaper 8a87378f00 👻 : Add Support For Apple's New API - Core Audio Tap API `CATap`
[Reference](https://github.com/insidegui/AudioCap). This is Apple's latest system for allowing apps to access loopback audio streams eg: Desktop-Audio, Window-Audio, etc...
2026-02-05 00:37:24 -05:00
Mitchell Hashimoto 2d02e4bb54
remove redraw_inspector message 2026-02-01 14:32:37 -08:00
Mitchell Hashimoto 020fe35c48
macos: render inspectors on timed updates, pause when occluded 2026-02-01 14:22:10 -08:00
Mitchell Hashimoto fb8cb162ce
macos: Ghostty.Inspector 2026-01-31 09:22:26 -08:00
Mitchell Hashimoto 32f5677a94
macos: slow down inspector trackpad (precision) scrolling 2026-01-27 08:34:35 -08:00
Mitchell Hashimoto 0de5f43254
macos: filter only supported commands in the command palette
This got accidentally regressed when we did the jump options.
2026-01-27 08:17:22 -08:00
Mitchell Hashimoto 6ace63acc4
macOS: xib changes from xcode
Literally just opening these on Xcode 26.2 does this, so we should
commit it lol.
2026-01-27 08:10:00 -08:00
Mitchell Hashimoto 338c9b15aa
splits: make resize_split and toggle_split_zoom non-performable with single pane (#10376)
Refer to discussion #10000 

When a tab contains only a single split, resize_split and
toggle_split_zoom actions now return false (not performed). This allows
keybindings marked with `performable: true` to pass the event through to
the terminal program.

The performable flag causes unperformed actions to be treated as if the
binding didn't exist, so the key event is sent to the terminal instead
of being consumed.

- Add isSplit() helper to SplitTree to detect single-pane vs split state
- Update GTK resizeSplit/toggleSplitZoom to return false when single
pane
- Update macOS resizeSplit/toggleSplitZoom to return Bool and check
isSplit
- Add unit test for isSplit method
2026-01-22 08:23:57 -08:00
MrConnorKenway 02d6dc0672 feat(macos): focus surface view if search box is manually closed 2026-01-22 09:25:47 +08:00
Mitchell Hashimoto 6730afe312
macOS: Add GhosttyUITests (Drafting to save some ci checks) (#9185)
### Background

~~I was trying to add a few UI test cases for
`macOS-titlebar-style`[Already in this PR]~~. In order to do this, I
need a way from `GhosttyKit` to load a temporary configuration without
messing around with users'.

### Changes

- Add `ghostty_config_load_file` using the existing
[`loadFile`](dafb9e89a3/src/config/Config.zig (L3399))
- Use `xcbeautify` to format test&build errors
**Couldn't find a way to do this in `GhosttyXcodebuild`, if you have a
better approach please let me know!**
- Add GhosttyUITests target and test cases for
`GhosttyTitlebarTabsUITests`(#2349) and `GhosttyThemeTests`(#9360)

### NOTE

Running UI tests on the runner could be **very** slow and I couldn't
find a way to guarantee success, so I made these only runnable by
manually testing in Xcode.

Better to squash this🤪

> > Some of the test cases could fail when testing all the cases
together; a rerun would succeed.
2026-01-20 09:30:39 -08:00
Lars 3fda31a66a skip checking config file 2026-01-20 09:15:14 -08:00
Lars bfe5a4be8f move config loading to Config 2026-01-20 09:15:14 -08:00
Lukas 32562e0c98 Update macos/Sources/Ghostty/Ghostty.App.swift
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-20 09:15:14 -08:00
Lars 35b2e820ce typo fix 2026-01-20 09:15:14 -08:00
Lars 4154a730ee Fix some edge cases 2026-01-20 09:15:14 -08:00
Lars 27729bf8a7 only run ui tests manually with xcode 2026-01-20 09:15:14 -08:00
Lars 85da70c98d Add more theme test cases from #9360 2026-01-20 09:15:14 -08:00
Lars 4aabd94716 add theme tests 2026-01-20 09:15:14 -08:00
Lars d9ed325818 update config explicitly 2026-01-20 09:15:14 -08:00
Lars 6ada9c7844 test: add test for mergeAllWindows 2026-01-20 09:15:14 -08:00
Lars f52013787e test: using XCTAssertEqual to get more information 2026-01-20 09:15:14 -08:00
Lars f088ce38d9 test: read config before launching XCUIApplication 2026-01-20 09:15:14 -08:00
Lars f7608d0b95 macOS: reduce press duration 2026-01-20 09:15:14 -08:00
Lars b1290dc47b macOS: add titlebar tabs tests 2026-01-20 09:15:14 -08:00
Lars bcf42dde6c build: change deployment target 2026-01-20 09:15:14 -08:00
Lars a94a6e4b36 build: fix Ghostty-iOS compiling 2026-01-20 09:15:14 -08:00
Lars 4f667520fa macOS: GhosttyUITests 2026-01-20 09:15:14 -08:00
Mitchell Hashimoto 2db80e278e
feat(macos): if the search box is empty directly close the box (#10384)
referring to the discussion:
https://github.com/ghostty-org/ghostty/discussions/9814

This is a very small change addressing the behavior for closing the
search bar. This removes an extra step when closing the search bar if
the query is empty
2026-01-20 08:33:43 -08:00
Tim Culverhouse 5ee56409c7
macos: support mouse buttons 8/9 (back/forward)
Add support for mouse buttons 4-11 in the macOS app. Previously only
left, right, and middle buttons were handled. Now otherMouseDown/Up
events properly map NSEvent.buttonNumber to the corresponding Ghostty
mouse button, enabling back/forward button support.

Fixes: https://github.com/ghostty-org/ghostty/issues/2425
Amp-Thread-ID: https://ampcode.com/threads/T-019bd74e-6b2b-731d-b43a-ac73b3460c32
Co-authored-by: Amp <amp@ampcode.com>
2026-01-19 11:59:50 -06:00
Steven Lu 6db4e437ca splits: make resize_split and toggle_split_zoom non-performable with single pane
When a tab contains only a single split, resize_split and toggle_split_zoom
actions now return false (not performed). This allows keybindings marked with
`performable: true` to pass the event through to the terminal program.

The performable flag causes unperformed actions to be treated as if the
binding didn't exist, so the key event is sent to the terminal instead of
being consumed.

- Add isSplit() helper to SplitTree to detect single-pane vs split state
- Update GTK resizeSplit/toggleSplitZoom to return false when single pane
- Update macOS resizeSplit/toggleSplitZoom to return Bool and check isSplit
- Add unit test for isSplit method
2026-01-19 17:34:34 +07:00
Nishant Joshi c8f56ddaf8
feat(macos): if the search box is empty directly close the box 2026-01-18 10:08:51 -08:00
Jon Parise 1537590a5f macos: cycle through our icons in the About view
Clicking on the icon immediately advances to the next one. Hovering on
the icon pauses the automatic cycling, and the "help" tooltip displays
the icon's configuration name (for `macos-icon`).
2026-01-12 15:20:14 -05:00
Mitchell Hashimoto f34c69147a
macos: use the new binding flags information value to trigger menu 2026-01-09 07:13:14 -08:00
Mitchell Hashimoto 5a7fdf735e
macos: custom tab title shows bell if active
Fixes #10210
2026-01-07 13:32:58 -08:00
Mitchell Hashimoto 323d362bc1
macos: dragging last window out of quick terminal works 2026-01-07 09:33:37 -08:00
Lukas a265462aa6
macOS: moving a focused split to another tab should also update the previous tab 2026-01-07 09:18:41 -08:00
Lukas 02fc0f502f
macOS: rename function to avoid mutating misunderstanding 2026-01-07 09:18:17 -08:00
Leah Amelia Chen c559a1dbba
Allow for default or inherited CWD in new window, tab and split surfaces (redone for GTK-NG) (#9158) 2026-01-07 20:45:06 +08:00
Mitchell Hashimoto 7d0157e69a
macOS: add Cmd+J "Jump to Selection" menu item and default binding
This matches other built-in macOS apps like Terminal, Notes, Safari. We
already had the binding, just needed to create the menu.

https://ampcode.com/threads/T-019b956a-f4e6-71b4-87fa-4162258d33ff
2026-01-06 14:30:11 -08:00
Mitchell Hashimoto 05a41c7772
macos: clean up menu 2026-01-06 14:20:34 -08:00
Mitchell Hashimoto f07d600e43
macos: start_search with needle changes needle 2026-01-06 14:14:22 -08:00
Mitchell Hashimoto 8e28f58b42
rename the selection search binding, unify into start_search action 2026-01-06 14:10:42 -08:00
Aaron Ruan 9b6a3be993
macOS: Selection for Find feature
Adds the `selection_for_search` action, with Cmd+E keybind by default.
This action inputs the currently selected text into the search
field without changing focus, matching standard macOS behavior.
2026-01-06 22:21:55 +08:00
Peter Guy b119bc6089
consolidated enums 2026-01-05 16:47:04 -08:00
Peter Guy d660799723
Consolidate the several ghostty_surface_inherited_config
functions back into a single function with a second parameter for the source context.
2026-01-05 16:47:04 -08:00
Peter Guy c035fb5385
Add an enum type for the C API 2026-01-05 16:47:04 -08:00
Peter Guy 496f5b3ed7
Add the context to the Swift layer.
- Define NewSurfaceContext to match the Zig enum name and avoid magic numbers.
2026-01-05 16:47:04 -08:00
Peter Guy dba0ff5339
Add C API function to handle new surfaces of different types 2026-01-05 16:47:04 -08:00
Martin Emde c384cd050e
Fix Mac window becomes unmovable after pane rearrangement
After rearranging panes, the window becomes permanently unmovable.
Grab handles temporarily set `window.isMovable = false` on hover to prevent
window dragging from interfering with pane dragging.

Override `viewWillMove(toWindow:)` to catch when the view is being removed from
the window. This lifecycle method is called before the window reference
becomes nil, allowing us to restore `window.isMovable`.
2026-01-01 15:56:25 -08:00
Ivan Buiko c89627fe75 macOS: Add menu shortcut handling in macOS key event processing
Allow menu bar to flash for shortcuts and handle key equivalents before
checking for Ghostty key bindings
2026-01-01 12:47:16 -08:00
Mitchell Hashimoto b3fbf11b0c
macOS: temporarily disable `window.isMovable` to fix #10110 (#10125)
Fixes #10110
2026-01-01 12:45:08 -08:00
Jon Parise 12024ed831 macos: simplify .keyDown guard condition
This condition is more naturally expressed as a `guard`.
2026-01-01 10:17:48 -05:00
Lukas 1249f3b88c
macOS: temporarily disable `window.isMovable` to fix #10110 2026-01-01 14:37:08 +01:00
Lukas 74fc48682a
macOS: remove unused file 2026-01-01 14:31:11 +01:00
Mitchell Hashimoto 18abcaa797
macos: remove tab hover event, seems native handles it 2025-12-31 06:15:04 -08:00
Mitchell Hashimoto d4ba0fa27e
macos: last surface should close tab immediately not window 2025-12-30 15:07:28 -08:00
Mitchell Hashimoto 3e399a3d35
macos: detect surface tab bar hovers and focus them 2025-12-30 15:07:27 -08:00
Mitchell Hashimoto f32d54bedb
macos: make surface grab handle visible in light mode (#10111) 2025-12-30 13:14:49 -08:00
Mitchell Hashimoto c34bb5976a
macos: Ghostty.Command must copy string values
We were previously storing the C struct which contained pointers into
ephemeral memory that could cause segfaults later on.
2025-12-30 13:09:20 -08:00
Mitchell Hashimoto 43c7277a60
macos: make surface grab handle visible in light mode 2025-12-30 13:06:55 -08:00
John Xu 53c510ac40
macos: keep glass titlebar inset in sync on layout 2025-12-30 16:32:12 +08:00
Mitchell Hashimoto a826892ef7
macos: make undo/redo work for final split dragged out
Fixes #10093
2025-12-29 11:15:19 -08:00
Mitchell Hashimoto 7512f6158b
macos: fix bugs 2025-12-29 10:47:00 -08:00
Mitchell Hashimoto 19f7b57cd1
macos: fixup focus issues when closing the new window 2025-12-29 10:36:24 -08:00
Mitchell Hashimoto 29edbbbc86
macos: open dragged windows where they are dropped 2025-12-29 10:21:21 -08:00
Mitchell Hashimoto 5ecd26727e
macos: allow pulling split out into its own window 2025-12-29 10:11:59 -08:00
Mitchell Hashimoto 89c515cab5
macos: new window from tree in TerminalController 2025-12-29 10:03:36 -08:00
Mitchell Hashimoto 25c413005b
macos: emit a notification when the surface drag ends outside area 2025-12-29 09:55:18 -08:00
Mitchell Hashimoto c164e3bc02
macos: fix messy rebase 2025-12-29 07:13:25 -08:00
Mitchell Hashimoto cfa3de5d9b
macos: change style 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto 1b1ff3d76c
macos: add some unit tests 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto dbeeb952cc
macos: fix dragging point 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto e56dce3d84
macos: don't create drop zone at all if self dragging 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto e1f22472f6
macos: convert the transferable to a nsdraggingitem 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto 7b743164ef
macos: fix iOS builds 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto be97b5bede
macOS: convert Surface dragging to use NSDraggingSource 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto 9b7124cf62
macos: use preference key to detect self dragging 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto 5245757875
macos: all sorts of cleanups 2025-12-29 06:55:01 -08:00
Mitchell Hashimoto 1dd8e3ef4a
macos: add GhosttyDelegate for global operations 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 9724541a33
macos: unify split callbacks into a single tagged enum 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 60bc5a9ae7
macos: clean up some SwiftUI nesting 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 5916755388
macos: drop splits across windows 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 8f8b5846c6
macos: hook up onDrop to move splits 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto d92fe44d0d
macos: fix various iOS build errors 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 485b861342
macos: drag preview is an image of the surface 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 5d8c9357c0
macos: move around some functions 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 0a80f77766
macos: wire up onDrop 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 43d87cf9f8
macos: setup drop UI on our split views 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto ddfd4fe7c2
macos: export our ghostty surface ID type 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 304e2612ab
macOS: work on drop destination 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 5045688623
macos: move grab handle to separate file 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 57bb636655
surfaceview as transferable 2025-12-29 06:55:00 -08:00
Mitchell Hashimoto 88adffd734
macOS: add handle to the top of surfaces that can be used to drag
UI only
2025-12-29 06:54:59 -08:00
Mitchell Hashimoto ab232b3060
macos: move Ghostty surface view into dedicated folder 2025-12-29 06:54:59 -08:00
Mitchell Hashimoto 551031e41f
macOS: move `NSGlassEffectView` into `TerminalViewContainer` (#10062)
- Fixes #9991
> Modifying the subview of NSThemeFrame seems "dangerous" and
unpredictable.
- Provides correct `intrinsicContentSize` as previous
`NSHostingView<TerminalView>` did
  > Fixes regression caused by #10046

> [!NOTE]
> AI Proofread some of my comments
2025-12-29 06:52:18 -08:00
Daniel Wennberg b7a12effce Only use macOS 26.0 workarounds on macOS 26.0 2025-12-28 09:47:22 -08:00
Mitchell Hashimoto 14f592b8d4
macOS: Don't duplicate command palette entries for terminal commands
This is a regression introduced when we added macOS support for custom
entries. I mistakingly thought that only custom entries were in the
config, but we do initialize it with all!
2025-12-26 11:03:50 -08:00
Lukas 6ab884d69f
macOS: fix intrinsicContentSize of `TerminalViewContainer` 2025-12-26 13:35:25 +01:00
Zongyuan Li 88e471e015 fix(iOS): fix iOS app startup failure
Fixes #7643

This commit address the issue with 3 minor fixes:
1. Initialize ghostty lib before app start, or global allocator will
   be null.
2. `addSublayer` should be called on CALayer object, which is the
   property 'layer' of UIView
3. According to apple's [document](https://developer.apple.com/documentation/metal/mtlstoragemode/managed?language=objc),
   managed storage mode is not supported by iOS. So always use shared
   mode.

FYI, another [fix](https://github.com/mitchellh/libxev/pull/204) in libxev
is also required to make iOS app work.
2025-12-26 18:53:45 +08:00
Lukas 1c90af3569
macOS: move `NSGlassEffectView` into `TerminalViewContainer` 2025-12-26 11:44:30 +01:00
Mitchell Hashimoto 2415116ad0
Revert "macOS: move `NSGlassEffectView` into `TerminalViewContainer` (#10046)"
This reverts commit b8490f40c5, reversing
changes made to 050278feae.
2025-12-25 13:52:59 -08:00
Mitchell Hashimoto b8490f40c5
macOS: move `NSGlassEffectView` into `TerminalViewContainer` (#10046)
Fixes #9991, modifying the subview of `NSThemeFrame` seems "dangerous"
and unpredictable.

> [!NOTE]
> AI Proofread some of my comments



https://github.com/user-attachments/assets/c443cf71-8a00-4c37-b008-d89b7f1564a3
2025-12-25 12:51:47 -08:00
rezky_nightky bf73f75304
chore: fixed some typo
Author: rezky_nightky <with dot rezky at gmail dot com>
Repository: ghostty
Branch: main
Signing: GPG (4B65AAC2)
HashAlgo: BLAKE3

[ Block Metadata ]
BlockHash: c37f4ee817412728a8058ba6087f5ca6aaff5a845560447d595d8055972d0eac
PrevHash: 3510917a780936278debe21786b7bae3a2162cb3857957314c3b8702e921b3d4
PatchHash: 5e5bb4ab35df304ea13c3d297c6d9a965156052c82bccf852b1f00b7bcaa7dd4

FilesChanged: 18
Lines: +92 / -92

Timestamp: 2025-12-25T17:27:08Z
Signature1: c1970dbb94600d1e24dfe8efcc00f001664db7b777902df9632a689b1d9d1498
Signature2: 30babb1e3ca07264931e067bfe36c676fb7988c2e06f8c54e0c9538fe7c7fc9a
2025-12-26 00:27:08 +07:00
Mitchell Hashimoto f7f29934f3
macos: ghostty.command should be part of iOS build 2025-12-24 14:41:41 -08:00
Mitchell Hashimoto 12523ca61c
macOS: command-palette-entry is now visible in macOS 2025-12-24 14:33:21 -08:00
Lukas 574ee470bd
macOS: move `NSGlassEffectView` into `TerminalViewContainer` 2025-12-24 23:10:31 +01:00
Lukas 7ce88b6811
macOS: fix initial surface color scheme in quickTerminal 2025-12-24 21:46:42 +01:00
Mitchell Hashimoto 6b7a7aacf2
macos: apply window position after setting content size (#10007)
> **Note**: This is a re-submission of #9952, which was closed in favor
of #9975. However, as noted in my [comment on
#9975](https://github.com/ghostty-org/ghostty/pull/9975#issuecomment-3677916608),
the issue still persists.

## Summary

- Fix `window-position-x/y` not being applied when `window-width/height`
is also configured

## Problem

When both `window-position-x/y` and `window-width/height` are
configured, the window position was not being applied correctly. The
window would appear near the center of the screen instead of the
specified position.

This worked correctly in v1.2.3 but regressed afterwards.

## Root Cause

This is a regression introduced in c75bade89 (#9747).

The commit refactored the default size logic from a computed `NSRect?`
property to a `DefaultSize` enum with `.frame` and
`.contentIntrinsicSize` cases.

**Before (working):**
```swift
private var defaultSize: NSRect? {
    // ... calculate frame ...
    return adjustForWindowPosition(frame: frame, on: screen)  // ← position was applied
}
```

**After (broken):**
```swift
enum DefaultSize {
    case frame(NSRect)
    case contentIntrinsicSize
    
    func apply(to window: NSWindow) {
        case .contentIntrinsicSize:
            window.setContentSize(size)
            window.constrainToScreen()
            // ← adjustForWindowPosition call was lost
    }
}
```

When `window-width/height` is configured, the `.contentIntrinsicSize`
case is used. This case only called `setContentSize` and
`constrainToScreen`, but did not apply the window position adjustment.

## Why This Fix is Correct

`DefaultSize.apply()` is intentionally **not** responsible for
position—it only handles **size**:

1. `apply()` is also called from `returnToDefaultSize(_:)` menu action
2. When user triggers "Return to Default Size", only the **size** should
reset—**not the position**
3. If we added position logic inside `apply()`, the window would
unexpectedly jump back to its initial position

Therefore, position adjustment belongs **outside** of `apply()`,
specifically during initial window setup in `windowDidLoad`.

## Fix

Call `adjustForWindowPosition` after applying the content intrinsic size
to ensure the window position is correctly set during initial window
creation.
2025-12-23 07:08:16 -08:00
Yasu Flores 5bd814adf8 move guard down to keep surfaceModel logic together 2025-12-22 08:53:43 -06:00
Suyeol Jeon b4a5ddfef9 macos: apply window position after setting content size
When window-width/height is configured, the window size is set via
setContentSize in windowDidLoad. However, window-position-x/y was not
being applied after this resize, causing the window to appear at an
incorrect position.

This was a regression introduced in c75bade89 which refactored the
default size logic from a computed NSRect property to a DefaultSize
enum. The original code called adjustForWindowPosition after calculating
the frame, but this was lost during the refactoring.

Fixes the issue by calling adjustForWindowPosition after applying
contentIntrinsicSize to ensure window position is correctly set.
2025-12-22 15:09:00 +09:00
Yasu Flores 2215b731da Address warning and add guard clause 2025-12-21 20:47:56 -06:00
Yasu Flores ab352b5af9 macos: Support native actions to move to beginning of document and move to end of document 2025-12-21 20:26:57 -06:00
Mitchell Hashimoto 39481453fe
macos: show the key sequence overlay if no tables are active 2025-12-21 13:32:24 -08:00
Lukas 7d3db17396
macOS: key table animations and cleanup 2025-12-21 09:29:47 +01:00
Mitchell Hashimoto dc8f082392
macos: copy the key table action bytes 2025-12-20 20:36:35 -08:00
Mitchell Hashimoto eac0ec14fd
macOS: revamped key table/sequence UI 2025-12-20 20:27:56 -08:00
Mitchell Hashimoto 901618cd8f
macOS: hook up key table apprt action to state 2025-12-20 20:01:38 -08:00
Mitchell Hashimoto 63422f4d4e
add the catch_all binding key
Part of #9963

This adds a new special key `catch_all` that can be used in keybinding
definitions to match any key that is not explicitly bound. For example:
`keybind = catch_all=new_window` (chaos!). 

`catch_all` can be used in combination with modifiers, so if you want to
catch any non-bound key with Ctrl held down, you can do:
`keybind = ctrl+catch_all=new_window`.

`catch_all` can also be used with trigger sequences, so you can do:
`keybind = ctrl+a>catch_all=new_window` to catch any key pressed after
`ctrl+a` that is not explicitly bound and make a new window!

And if you want to remove the catch all binding, it is like any other:
`keybind = catch_all=unbind`.
2025-12-19 15:03:38 -08:00
Mitchell Hashimoto d1bea9d737
macos: window width/height should be clamped, work with position
Fixes #9952
Fixes #9969

This fixes our `constrainToScreen` implementation to properly clamp the
window size to the visible screen its coming on as documented. Further,
this addresses the positioning problem, too.
2025-12-19 10:30:03 -08:00
Mitchell Hashimoto 86a0eb1a75
macos: hide tab overview on `escape`
This hides the macOS tab overview when the `escape` key is pressed.

Our solution is a bit blunt here and I don't think its right. I think we
have a first responder problem somewhere but I haven't been able to find
it and find the proper place to implement `cancel` (or equivalent) to
hide the overview. I tried implementing `cancel` in all the places I
expect the responder chain to go through but none worked.

For now let's do this since it is pretty tightly scoped!
2025-12-19 07:13:47 -08:00
Mitchell Hashimoto 0ace736f46
macos: remove the command palette appear/disappear animation
Lots of people complained about this and I don't see value in it.
2025-12-18 15:36:11 -08:00
Jake Nelson 377bcddb46 fix(macOS): re-apply icon after app update 2025-12-18 12:55:49 +11:00
Mitchell Hashimoto e1d0b22029
macos: allow searching sessions by color too 2025-12-17 10:52:03 -08:00
Mitchell Hashimoto 842583b628
macos: fix uikit build 2025-12-17 10:26:02 -08:00
Mitchell Hashimoto 829dd1b9b2
macos: focus shenangians 2025-12-17 10:13:53 -08:00
Mitchell Hashimoto e1356538ac
macos: show a highlight animation when a terminal is presented 2025-12-17 10:12:44 -08:00
Mitchell Hashimoto d23f7e051f
macos: stable sort for surfaces 2025-12-17 09:52:06 -08:00
Mitchell Hashimoto 1fd3f27e26
macos: show pwd for jump options 2025-12-17 09:47:16 -08:00
Mitchell Hashimoto b30e94c0ec
macos: sort in the focus jumps in other commands 2025-12-17 09:34:30 -08:00
Mitchell Hashimoto 835fe3dd0f
macos: add the active terminals to our command palette to jump 2025-12-17 09:30:39 -08:00