summaryrefslogtreecommitdiff
path: root/macos/Sources/Helpers
AgeCommit message (Collapse)Author
2025-10-10macos: update accessory in the titlebar should not move the windowMitchell Hashimoto
This is annoyingly easy to trigger, just disable this.
2025-09-18macos: window-position-x/y are from top-left cornerMitchell Hashimoto
Fixes #8672 Almost fully written by AI: https://ampcode.com/threads/T-86df68a3-578c-4a1c-91f3-788f8b8f0aae I reviewed all the code.
2025-08-26macos: fix quick terminal fullscreenAlexander Lais
Fullscreen on quick terminal was failing with a crash, when it tried to save the state of a non-existent toolbar and its accessory view controllers.
2025-07-06macos: open URLs with NSWorkspace APIs instead of `open`Mitchell Hashimoto
Fixes #5256 This updates the macOS apprt to implement the `OPEN_URL` apprt action to use the NSWorkspace APIs instead of the `open` command line utility. As part of this, we removed the `ghostty_config_open` libghostty API and instead introduced a new `ghostty_config_open_path` API that returns the path to open, and then we use the `NSWorkspace` APIs to open it (same function as the `OPEN_URL` action).
2025-07-05macos: support configuration via CLI argumentsMitchell Hashimoto
This makes it so `zig build run` can take arguments such as `--config-default-files=false` or any other configuration. Previously, it only accepted commands such as `+version`. Incidentally, this also makes it so that the app in general can now take configuration arguments via the CLI if it is launched as a new instance via `open`. For example: open -n Ghostty.app --args --config-default-files=false This previously didn't work. This is kind of cool. To make this work, the libghostty C API was modified so that initialization requires the CLI args, and there is a new C API to try to execute an action if it was set.
2025-06-21macos: the approval dialog is now foreverMitchell Hashimoto
2025-06-21macos: address some feedbackMitchell Hashimoto
2025-06-21macos: intents all ask for permissionMitchell Hashimoto
2025-06-21macos: support env vars for surface config, clean up surface configMitchell Hashimoto
2025-06-21macos: GetTerminalDetails intentMitchell Hashimoto
2025-06-17macos: disambiguate close tab vs close window for confirmationMitchell Hashimoto
This fixes an issue where pressing the red close button in a window or the "x" button on a tab couldn't differentiate and would always close the tab or close the window (depending on tab counts). It seems like in both cases, AppKit triggers the `windowShouldClose` delegate method on the controller, but for the close window case it triggers this on ALL the windows in the group, not just the one that was clicked. I implemented a kind of silly coordinator that debounces `windowShouldClose` calls over 100ms and uses that to differentiate between the two cases.
2025-06-17ci: build macOS releases with Xcode 26Mitchell Hashimoto
Resolves #7591 This moves our CI to build macOS on Sequoia (macOS 15) with Xcode 26, including the new macOS 26 beta SDK. Importantly, this will make our builds on macOS 26 use the new styling. I've added a new job that ensures we can continue to build with Xcode 16 and the macOS 15 SDK, as well, although I think that might come to an end when we switch over to an IconComposer-based icon. I'll verify then. For now, we continue to support both. I've also removed our `hasLiquidGlass` check, since this will now always be true for macOS 26 builds.
2025-06-14macos: menu item symbols for TahoeMitchell Hashimoto
This is recommended for macOS Tahoe and all standard menu items now have associated images. This makes our app look more polished and native for macOS Tahoe. For icon choice, I tried to copy other native macOS apps as much as possible, mostly from Xcode. It looks like a lot of apps aren't updated yet. I'm absolutely open to suggestions for better icons but I think these are a good starting point. One menu change is I moved "reset font size" above "increase font size" which better matches other apps (e.g. Terminal.app).
2025-06-13macos: use a runtime liquid glass check for our Tahoe stylingMitchell Hashimoto
2025-06-13macos: don't restore tab bar with non-native fsMitchell Hashimoto
2025-06-13macos: fix up some sequoia regressionsMitchell Hashimoto
2025-06-12macos: tahoe titlebar tabs taking shapeMitchell Hashimoto
2025-06-12macos: hide the reset zoom titlebar accessory when tab bar is shownMitchell Hashimoto
2025-06-12macos: non-native fullscreen should restore toolbarsMitchell Hashimoto
2025-06-12macos: add reset zoom to all window titlesMitchell Hashimoto
2025-06-12macoS: Split out terminal tabs for ventura vs tahoeMitchell Hashimoto
2025-06-11typosMitchell Hashimoto
2025-06-11macos: native terminal style works with new subclassesMitchell Hashimoto
2025-06-11macos: transparent titlebar handles transparent backgroundMitchell Hashimoto
2025-06-11macos: transparent titlebar needs to be rehidden when tabs changeMitchell Hashimoto
2025-06-11macos: add NSView hierarchy debugging codeMitchell Hashimoto
2025-06-11wip: redo terminal window stylingMitchell Hashimoto
2025-06-07macos: make sure we're not registering unnecessary undosMitchell Hashimoto
2025-06-07macos: compile errors in CIMitchell Hashimoto
2025-06-07macos: configurable undo timeoutMitchell Hashimoto
2025-06-07macos: implement a custom ExpiringUndoManager, setup undo for new/closeMitchell Hashimoto
2025-06-07wip: undoMitchell Hashimoto
2025-06-05macOS: New value-based split tree implementation, move split logic out of ↵Mitchell Hashimoto
SwiftUI into AppKit (#7523) This is a major rework of how we represent, handle, and render splits in the macOS app. This new PR moves the split structure into a dedicated, generic (non-Ghostty-specific) value-type called `SplitTree<V>`. All logic associated with splits (new split, close split, move split, etc.) is now handled by notifications on `BaseTerminalController`. The view hierarchy is still SwiftUI but it has no logic associated with it anymore and purely renders a static tree of splits. Previously, the split hierarchy was owned by AppKit in a type called `SplitNode` (a recursive class that contained the tree structure). All logic around creating, zooming, etc. splits was handled by notification listeners directly within the SwiftUI hierarchy. SwiftUI managed a significant amount of state and we heavily used bindings, publishers, and more. The reasoning for this is mostly historical: splits date back to when Ghostty tried to go all-in on SwiftUI. Since then, we've taken a more balanced approach of SwiftUI for views and AppKit for data and business logic, and this has proven a lot more maintainable. ## Spatial Navigation Previously, focus moving was handled by traversing the tree structure. This led to some awkward behaviors. See: https://github.com/ghostty-org/ghostty/issues/524#issuecomment-2668396095 In this PR, we now handle focus moving spatially. This means that move "left" means moving to the visually left split (from the top-left corner, a future improvement would be to do it from the cursor position). Concretely, given the following split structure: ``` +----------+-----+ | | b | | | | | a +-----+ | | | | | | | | | | | | |----------| d | | c | | | | | +----------+-----+ ``` Moving "right" from `c` now moves to `d`. Previously, it would go to `b`. On Linux, it still goes to `b`. ## Value Types One of the major architectural shifts is moving **purely to immutable value types.** Whenever a split property changes such as a new split, the ratio between splits, zoomed state, etc. we _create an entirely new `SplitTree` value_ and replace it along the entire view hierarchy. This is in some ways wasteful, but split hierarchies are relatively small (even the largest I've seen in practical use are dozens of splits, which is small for a computer). And using value types lets us get rid of a ton of change notification soup around the SwiftUI hierarchy. We can rely on reference counting to properly clean up our closed views. > [!NOTE] > > As an aside, I think value types are going to make it a lot easier in the future to implement features like "undo close." We can just keep a trailing list of surface tree states and just restore them. This PR doesn't do anything like that, but it's now possible. ## SwiftUI Simplicity Our SwiftUI view hierarchy is dramatically simplified. See the difference in `TerminalSplitTreeView` (new) vs `TerminalSplit` (old). There's so much less logic in our new views (almost none!). All of it is in the AppKit layer which is just way nicer. ## AI Notes This PR was heavily written by AI. I reviewed every line of code that was rewritten, and I did manually rewrite at every step of the way in minor ways. But it was very much written in concert. Each commit usually started as an AI agent writing the whole commit, then nudging to get cleaned up in the right way. One thing I found in this task was that until the last commit, I kept the entire previous implementation around and compiling. The agent having access to a previous working version of code during a refactor made the code it produced as follow up in the new architecture significantly better, despite the new architecture having major fundamental differences in how it works!
2025-06-05fix: exit non-native fullscreen on closeFrancisco Giordano
2025-06-05macos: moving some files aroundMitchell Hashimoto
2025-06-05macos: remove the unused resizeEvent code from SplitViewMitchell Hashimoto
2025-06-05macos: fix up command palette, focusingMitchell Hashimoto
2025-06-05macos: focus split previous/nextMitchell Hashimoto
2025-05-06macOS: save/restore firstResponder on non-native fullscreenMitchell Hashimoto
Fixes #6999 It appears that at some point one of the operations causes focus to move away for non-native fullscreen. We previously relied on the delegate method to restore this but a better approach appears to handle this directly in the fullscreen implementations. This fixes the linked issue. I still think long term all the `Ghostty.moveFocus` stuff is a code smell and we should be auditing all that code to see if we can eliminate it. But this is a step in the right direction, and removes one of those uses.
2025-05-06macOS: handle scenario cgWindowId is nilMitchell Hashimoto
Fixes #7114 Supercedes #7271 This fixes a crash that could occur with non-native fullscreen and `fullscreen = true` set at once. The "windowNumber" can be `<= 0` if the window "doesn't have a window device." I don't fully know all the scenarios this is true but it is true when the window is not visible, at least.
2025-04-24feat: beautify command paletteAaron Ruan
2025-04-23macOS: add descriptions for PgUp, PgDown, End, and Home keysFriedrich Stoltzfus
These keys were not being assigned a description in the KeyboardShortcut extension. This caused problems for the macOS command pallete.
2025-04-21macOS: command palette visual tweaksMitchell Hashimoto
2025-04-21macOS: hook up command palette C API to actual command paletteMitchell Hashimoto
2025-04-19macOS: use KeyboardShortcut rather than homegrown KeyEquivalentMitchell Hashimoto
This replaces the use of our custom `Ghostty.KeyEquivalent` with the SwiftUI `KeyboardShortcut` type. This is a more standard way to represent keyboard shortcuts and lets us more tightly integrate with SwiftUI/AppKit when necessary over our custom type. Note that not all Ghostty triggers can be represented as KeyboardShortcut values because macOS itself does not support binding keys such as function keys (e.g. F1-F12) to KeyboardShortcuts. This isn't an issue since all input also passes through a lower level libghostty API which can handle all key events, we just can't show these keyboard shortcuts on things like the menu bar. This was already true before this commit.
2025-04-15macos: quick terminal uses padded notch mode if notch is visibleMitchell Hashimoto
Fixes #6612
2025-04-14macOS: quick terminal should retain menu if not frontmostMitchell Hashimoto
This is a bug I noticed in the following scenario: 1. Open Ghostty 2. Fullscreen normal terminal window (native fullscreen) 3. Open quick terminal 4. Move spaces, QT follows 5. Fullscreen the quick terminal The result was that the menu bar would not disappear since our app is not frontmost but we set the fullscreen frame such that we expected it.
2025-04-14macOS: non-native fullscreen should not hide menu on fullscreen spaceMitchell Hashimoto
Fixes #7075 We have to use private APIs for this, I couldn't find a reliable way otherwise.
2025-02-13macos: add `padded-notch` option for `macos-non-native-fullscreen`Mitchell Hashimoto
Finishes #378 Supercedes #4159 This adds a new enum value for `macos-non-native-fullscreen`: `padded-notch`. This value will add padding to the top of the window to account for the notch on applicable devices while still hiding the menu. This value is preferred over "visible-menu" by some people because for screens without a notch, the window will take up the full height. The plan in the future is that we may color the padded area when a notch is present. In this commit it appears as transparent.
2025-02-11Remember last focused window position for next startupBryan Lee