Commit Graph

146 Commits (cba82e976cce022ff0ef11d57270db1114ab7de7)

Author SHA1 Message Date
Mitchell Hashimoto 7b48eb5c62
macos: add change tab title to menu 2025-12-11 16:16:12 -08:00
Lukas 94f88c8b54
macOS: fix toggle_visibility behaviour with tabbed windows
This fixes regression of #5690, which kind of comes from #9576. 05b42919d5 (before #9576) has weird behaviours too, restored windows are not properly focused. With this pr, we only order `selectedWindow` front so we won't mess up with its selection state and the order of the tab group.
2025-11-28 10:14:07 +01:00
Mitchell Hashimoto 7835ad0ea4
macos: more menu items 2025-11-26 08:50:05 -08:00
Mitchell Hashimoto 3f7cfca4b4
macos: add find menu item 2025-11-26 08:50:05 -08:00
Lukas 6f75cc56f6
macOS: Only change the icon if needed
Fixes #9666
2025-11-22 16:48:39 +01:00
Lukas bcb5112b24
macOS: restore visiblity state when hiding quick terminal 2025-11-13 11:30:43 +01:00
Lukas 7e3aba7c99
macOS: remove `readyToInstall` state in update capsule
There is a sparkle-related 'issue' with the previous implementation. When you download/install in the `updateAvailable` state, if you don't install it, then check the updates again. Sparkle loses its downloaded stage in the delegate (it's normal when I use the sparkle source code). This time, when you click install in the `updateAvailable` state, it just uses the previous downloaded package and starts to install, without calling `showReady(toInstallAndRelaunch:)`.

I think removing `readyToInstall` in our customed ui, will reduce one step to install an update for most of the users out there, which makes sense, since the current package is pretty small, only takes a few seconds to download for a normal network, and they intended to install this update.
2025-11-09 20:24:24 +01:00
Lars 7472fb7732
macOS: set the macos-icon from a separate thread 2025-11-05 12:27:35 +01:00
Dusk 27b0978cd5
macos: use system beep for bell (#9339)
This seems pretty straightforward. I've tested it and it does what I'd
expect it to do.

Fixes #9338
2025-10-26 03:24:52 +00:00
Mitchell Hashimoto 8f1a014afd
macos: clean up the "installing" update state (#9170)
This includes multiple changes to clean up the "installing" state:

- Ghostty will not confirm quit, since the user has already confirmed
they want to restart to install the update.
- If termination fails for any reason, the popover has a button to retry
restarting.
- The copy and badge symbol have been updated to better match the
reality of the "installing" state.

<img width="1756" height="890" alt="CleanShot 2025-10-12 at 15 04 08@2x"
src="https://github.com/user-attachments/assets/1b769518-e15f-4758-be3b-c45163fa2603"
/>

AI written:
https://ampcode.com/threads/T-623d1030-419f-413f-a285-e79c86a4246b fully
understood.
2025-10-12 15:20:26 -07:00
Xiangbao Meng 03e71e86a4
macOS: distinguish between Debug and Release(Stable/Tip) (#9149)
### Background

Been running Ghostty locally for a while now, and I use the Finder
service a lot. It often confuses me which one is the official one, until
I actually open it.

### Changes

- Use blueprint to distinguish from release app, if no custom icon
specified
- Change BundleDisplayName to Ghostty[Debug]
- Enable Info.plist preprocessing for reading
`$(INFOPLIST_KEY_CFBundleDisplayName)` for providing different services
with different configurations
> (Preprocessing was once reverted
before](https://github.com/ghostty-org/ghostty/commit/6508fec), so I'm
not sure whether this follows the 'rules' here, but for now, there are
no links in the plist file, so I think it’s
[safe](https://developer.apple.com/library/archive/technotes/tn2175/_index.html#:~:text=can%20pass%20the-,%2Dtraditional,-flag%20to%20the)
to enable it
2025-10-12 13:07:29 -07:00
Xiangbao Meng c8ea42b894
macOS: Fix New Tab behaviours (#9124)
- Fix `macos-dock-drop-behavior = new-tab` not working, which also
affects `open /path/to/directory -a Ghostty.app`
- Fix 'New Tab' in dock icon not working **when Ghostty's not active**

### Issue preview with `1.2.2(12187)`


https://github.com/user-attachments/assets/18068cc2-c25d-4360-97ab-cec22d5d3ff4
2025-10-10 09:31:55 -07:00
Mitchell Hashimoto e0ee10e902
macos: re-enable real update check 2025-10-10 08:44:25 -07:00
Mitchell Hashimoto 6993947a3a
macOS: Make a lot of things more robust 2025-10-10 08:27:30 -07:00
Mitchell Hashimoto bce49a0843
macos: hook up our new update controller 2025-10-08 21:41:18 -07:00
Mitchell Hashimoto b4ab1cc1ed
macos: clean up the permission request 2025-10-08 21:21:27 -07:00
Mitchell Hashimoto 9e17255ca9
macos: "OK" should dismiss error 2025-10-08 21:16:07 -07:00
Mitchell Hashimoto a55de09944
macos: update simulator to test various scenarios in UI 2025-10-08 21:09:06 -07:00
Mitchell Hashimoto 59829f5359
Sparkle user driver, drives updates to the view model. 2025-10-08 21:03:04 -07:00
Mitchell Hashimoto 81e3ff90a3
macOS: Show update information as an overlay 2025-10-08 13:29:39 -07:00
Mitchell Hashimoto fc347a6040
macOS: Move update view model over to App scope 2025-10-08 12:50:09 -07:00
Mitchell Hashimoto 09ba5a27a2
macOS: Unobtrusive update views 2025-10-08 12:50:09 -07:00
Mitchell Hashimoto f60bdb0faa
macos: set the app icon in syncAppearance to delay the icon update
Fixes #8734

This forces the app icon to be set on another event loop tick from
the main startup. 

In the future, we should load and set the icon completely in another
thread. It appears that all the logic we have is totally thread-safe.
2025-09-19 12:07:28 -07:00
Mitchell Hashimoto 431364cf16
macos: disable NSAutoFillHeuristicController on macOS 26
Fixes #8616

macOS 26 (as of RC1) has some pathological performance bug where the
terminal becomes unusably slow after some period of time. We aren't 100%
sure what triggers the slowdown, but it is app-wide (new tabs or windows
don't resolve it) and Instruments traces point directly to
NSAutoFillHeuristicController. Specifically, to the `debounceTextUpdate`
selector.

This is all not documented as far as I can find and also not open
source, so I have no idea what's going on.

The best I can tell is that the NSAutoFillHeuristicController has
something to do with enabling heuristic-based autofill such as SMS auth
codes in text input fields. I don't know what is causing it to go
haywire.

SMS autofill is not desirable in a terminal app, nor is any of the other
automatic autofill in macOS I know of (contact info, passwords, etc.).
So, we can just disable it.

This default isn't documented but I found it via a strings dump of the
AppKit binary blob and comparing it to the disassembly to see how it is
used. In my limited testing, this seems to work around the problem.
2025-09-14 13:05:01 -07:00
Mitchell Hashimoto 6324f2b3d8
macOS: ghostty launched via CLI should come to front
This fixes an issue I noticed where manually launching the `ghostty`
binary in the app bundle via the CLI would open the app but not create a
window or bring it to the front.
2025-09-06 07:16:51 -07:00
Mitchell Hashimoto fe3dab9467
macOS: SurfaceView should implement Identifiable
This has no meaningful functionality yet, it was one of the paths I was
looking at for #8505 but didn't pursue further. But I still think that
this makes more sense in general for the macOS app and will likely be
more useful later.
2025-09-03 09:17:37 -07:00
Mitchell Hashimoto 04956f3dc1
macos: require confirmation to run any script 2025-08-28 12:34:04 -07:00
Mitchell Hashimoto f1ea30dcf1
macos: when executing a script directly, always wait after command 2025-08-28 11:26:33 -07:00
Daniel Wennberg 7d60c7c75b macos: move activation to after new window/tab is created 2025-08-21 15:16:20 -07:00
Mitchell Hashimoto e01ff4093a
macos: have macos-dock-drop-behavior apply to all drops 2025-08-21 10:45:17 -07:00
David Keegan f9ad061ea8 Add macos-dock-drop-folder-behavior configuration option
This adds a new configuration option that controls whether folders
dropped onto the Ghostty dock icon open in a new tab (default) or
a new window.

The option accepts two values:
- tab: Opens folders in a new tab in the main window (default)
- window: Opens folders in a new window

This is useful for users who prefer window-based workflows over
tab-based workflows when opening folders via drag and drop.
2025-08-21 10:30:26 -07:00
Nicholas Mata f1c68f698b Correct Swift formatting inconsistencies 2025-08-21 10:00:15 -07:00
Nicholas Mata 5948bd3f02 Add support for 'custom' on 'macos_icon' to support a completely custom app icon 2025-08-21 10:00:15 -07:00
Nicholas Mata 29419e7aac Make macos icon persistent even when app is closed 2025-08-21 10:00:15 -07:00
Aaron Ruan 1f710768e9
Update Float on Top menu icon to square.filled.on.square 2025-07-28 09:26:54 +08:00
Weizhao Ouyang b7f6da7857 macos: add more Tahoe menu item icons from SF Symbols
Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
2025-07-25 22:14:13 +08:00
Mitchell Hashimoto b7ffbf933f
macos: open URLs with NSWorkspace APIs instead of `open`
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-06 21:01:01 -07:00
Mitchell Hashimoto 8c3caee15c
macOS: zig build run disables window saved state 2025-07-05 19:58:17 -07:00
Mitchell Hashimoto 7bd90e6ec4
Build system can build macOS app bundle and open it
`zig build run` on macOS now builds the app bundle via the `xcodebuild`
CLI and runs it. The experience for running the app is now very similar
to Linux or the prior GLFW build, where the app runs, blocks the zig
command, and logs to the terminal.

`xcodebuild` has its own build cache system that we can't really hook
into so it runs on every `zig build run` command, but it does cache and
I find its actually relatively fast so I think this is a good
replacement for the glfw-based system.
2025-07-04 13:32:15 -07:00
Mitchell Hashimoto 2fa4fc8902
reload configuration on SIGUSR2
This is done at the apprt-level for a couple reasons.

  (1) For libghostty, we don't have a way to know what the embedding
      application is doing, so its risky to create signal handlers that
      might overwrite the application's signal handlers.

  (2) It's extremely messy to deal with signals and multi-threading.
      Apprts have framework access that handles this for us.

For GTK, we use g_unix_signal_add.

For macOS, we use `DispatchSource.makeSignalSource`. This is an awkward
API but made for this purpose.
2025-07-01 15:51:58 -07:00
Mitchell Hashimoto 471098df30
macOS: Run scripts using stdin rather than executing directly
Fixes #7647

See #7647 for context. This commit works by extending the `input` work
introduced in #7652 to libghostty so that the macOS can take advantage
of it. At that point, its just the macOS utilizing `input` in order to
set the command and `exit` up similar to Terminal and iTerm2.
2025-06-22 21:06:32 -04:00
Mitchell Hashimoto 2c1e83ba2f
macos: intent to open quick terminal 2025-06-21 06:39:20 -07:00
Mitchell Hashimoto 7ae5018fe8
macos: new terminal intent 2025-06-21 06:39:18 -07:00
Mitchell Hashimoto 57c79fa357
macos: Tahoe menu item icons, missed the "Ghostty" menu entirely
This is a follow up to #7594, I missed an entire menu.
2025-06-15 07:48:20 -07:00
Mitchell Hashimoto 202020cd7d macos: menu item symbols for Tahoe
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-14 19:44:24 -07:00
Mitchell Hashimoto 6e77a5a6ca
macos: address quick terminal basic functionality with new API 2025-06-07 13:07:31 -07:00
Mitchell Hashimoto b234cb2014
macos: only process reopen if already activated 2025-06-07 12:46:15 -07:00
Mitchell Hashimoto 636b1fff8a
macos: initial window shouldn't support undo 2025-06-07 12:46:15 -07:00
Mitchell Hashimoto 33d128bcff
macos: remove TerminalManager
All logic related to TerminalController is now in TerminalController.
2025-06-07 12:46:15 -07:00
Mitchell Hashimoto b044f4864a
add undo/redo keybindings, default them on macOS 2025-06-07 12:46:14 -07:00