Commit Graph

1483 Commits (main)

Author SHA1 Message Date
Mitchell Hashimoto 1073e89a0d
macos: move context menu stuff in terminal window down to an ext 2025-12-11 13:40:01 -08:00
Mitchell Hashimoto f559bccc38
macos: clean up setting up the tab menu by using an NSMenu extension 2025-12-11 13:36:49 -08:00
Mitchell Hashimoto a0089702f1
macos: convert tab color view to SwiftUI 2025-12-11 13:27:51 -08:00
Mitchell Hashimoto 04913905a3
macos: tab color is codable for restoration 2025-12-11 07:24:46 -08:00
Mitchell Hashimoto 51589a4e02
macos: move TerminalTabColor to its own file 2025-12-11 07:23:51 -08:00
George Papadakis 1a65c1aae2 feat(macos): add tab color picker to tab context menu 2025-12-11 07:16:26 -08:00
Mitchell Hashimoto 669733d597
macos: remove iOS signing (dev team) 2025-12-10 21:21:05 -08:00
Mitchell Hashimoto 4a6d551941
macos: don't put NSMenu extension in iOS build 2025-12-10 21:20:39 -08:00
Mitchell Hashimoto eb75d48e6b
macos: add xmark to other tab close items 2025-12-10 20:56:07 -08:00
Mitchell Hashimoto 1387dbefad
macos: target should be the correct target 2025-12-10 20:50:28 -08:00
Mitchell Hashimoto dc641c7861
macos: change to NSMenu extension 2025-12-10 20:47:15 -08:00
Mitchell Hashimoto f612e4632c
macos: clean up some style on tab bar context menu configuring 2025-12-10 20:43:43 -08:00
Mitchell Hashimoto 4424451c59
macos: remove to "close to the right" 2025-12-10 20:28:27 -08:00
George Papadakis 625d7274bf Add close tabs on the right action 2025-12-10 20:14:27 -08:00
Mitchell Hashimoto 76c2de6088
macos: remove the tabBarView variable we can search it 2025-12-10 20:10:54 -08:00
Lukas 969bcbe8e3 Update macos/Sources/Features/Terminal/Window Styles/TitlebarTabsTahoeTerminalWindow.swift 2025-12-10 20:03:30 -08:00
Denys Zhak c0951ce6d8 macOS: fix tab context menu opens on macOS 26 with titlebar tabs 2025-12-10 20:03:30 -08:00
Daniel Wennberg 93d77ae436 Always use overlay scroller, flash when mouse moved 2025-12-10 13:33:18 -08:00
Mitchell Hashimoto 260e6dea59
macOS: fix theme reloading (#9360)
### Background
After #9344, the Ghostty theme won't change after switching systems',
and reverting #9344 will bring back the issue it fixed.

The reason these two issues are related is because the scheme change is
based on changes of `effectiveAppearance`, which is also affected by
setting the window's `appearance` or changing
`NSAppearance.currentDrawing()`.

### Changes
Instead of observing `effectiveAppearance`, we now explicitly update the
color scheme of surfaces, so that we can control when it happens to
avoid callback loops and redundant updates.

### Regression Tests

- [x] #8282
- [x] Reloading with `window-theme = light` should update Ghostty with
the default dark theme with a dark window theme (break before
[#83104ff](83104ff27a))
- [x] `window-theme = light \n macos-titlebar-style = native` should
update Ghostty with the default dark theme with a light window theme
- [x] Reloading from the default config to `theme=light:3024
Day,dark:3024 Night \n window-theme = light`, should update Ghostty with
the theme `3024 Day` with a light window theme (break on
[#d39cc6d](d39cc6d478))
- [x] Using `theme=light:3024 Day,dark:3024 Night`; Switching the
system's appearance should change Ghostty's appearance (break on
[#d39cc6d](d39cc6d478))
- [x] Reloading from `theme=light:3024 Day,dark:3024 Night` with a light
window theme to the default config, should update Ghostty with the
default dark theme with a dark window theme
- [x] Reloading from the default config to `theme=light:3024
Day,dark:3024 Night \n window-theme=dark`, should update Ghostty with
the theme `3024 Night` with a dark window theme
- [x] Reloading from `theme=light:3024 Day,dark:3024 Night \n
window-theme=dark` to `theme=light:3024 Day,dark:3024 Night` with light
system appearance, should update Ghostty from dark to light
- [x] Reload with quick terminal open
2025-12-10 12:56:20 -08:00
Lars 0c9082eb72
macOS: fix theme reloading
### Background
After #9344, the Ghostty theme won't change after switching systems', and reverting #9344 will bring back the issue it fixed.

The reason these two issues are related is because the scheme change is based on changes of `effectiveAppearance`, which is also affected by setting the window's `appearance` or changing `NSAppearance.currentDrawing()`.

### Changes
Instead of observing `effectiveAppearance`, we now explicitly update the color scheme of surfaces, so that we can control when it happens to avoid callback loops and redundant updates.

### Regression Tests

- [x] #8282
- [x] Reloading with `window-theme = light` should update Ghostty with the default dark theme with a dark window theme (break before [#83104ff](83104ff27a))
- [x] `window-theme = light \n macos-titlebar-style = native` should update Ghostty with the default dark theme with a light window theme
- [x] Reloading from the default config to `theme=light:3024 Day,dark:3024 Night \n window-theme = light`, should update Ghostty with the theme `3024 Day` with a light window theme (break on [#d39cc6d](d39cc6d478))
- [x] Using `theme=light:3024 Day,dark:3024 Night`; Switching the system's appearance should change Ghostty's appearance (break on [#d39cc6d](d39cc6d478))
- [x] Reloading from `theme=light:3024 Day,dark:3024 Night` with a light window theme to the default config, should update Ghostty with the default dark theme with a dark window theme
- [x] Reloading from the default config to `theme=light:3024 Day,dark:3024 Night \n window-theme=dark`, should update Ghostty with the theme `3024 Night` with a dark window theme
- [x] Reloading from `theme=light:3024 Day,dark:3024 Night \n window-theme=dark` to `theme=light:3024 Day,dark:3024 Night` with light system appearance, should update Ghostty from dark to light
- [x] Reload with quick terminal open

# Conflicts:
#	macos/Sources/Features/Terminal/BaseTerminalController.swift
2025-12-07 09:18:45 +01:00
voideanvalue aa504b2784 add assertionFailure for unexpected QuickTerminalSize tag 2025-12-07 00:51:37 +00:00
Mitchell Hashimoto c75bade896
macos: `window-width/height` is accurate even with other widgets
Fixes #2660

Rather than calculate our window frame size based on various chrome
calculations, we now utilize SwiftUI layouts and view intrinsic content
sizes with `setContentSize` to setup our content size ignoring all our
other widgets.

I'm sure there's some edge cases I'm missing here but this should be a
whole lot more reliable on the whole.
2025-11-28 13:32:03 -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 5c1679209d
macos: add hover styles to search buttons, cursor changes 2025-11-27 13:01:51 -08:00
Lukas dc08d057fe
macOS: use ConcentricRectangle on Tahoe 2025-11-26 21:00:14 +01:00
Lukas cbcd52846c
macOS: fix search dragging animation when corner is not changed 2025-11-26 21:00:14 +01:00
Qwerasd 4b01163c79 fix(macos): use strings' utf-8 lengths for libghostty calls
Swift conveniently converts strings to UTF-8 encoded cstrings when
passing them to external functions, however our libghostty functions
also take a length and we were using String.count for that, which
returns the number of _characters_ not the byte length, which caused
searches with multi-byte characters to get truncated.

I went ahead and changed _all_ invocations that pass a string length to
use the utf-8 byte length even if the string is comptime-known and all
ASCII, just so that it's proper and if someone copies one of the calls
in the future for user-inputted data they don't reproduce this bug.

ref:
https://developer.apple.com/documentation/swift/string/count
https://developer.apple.com/documentation/swift/stringprotocol/lengthofbytes(using:)
2025-11-26 12:00:58 -07:00
avarayr f5b923573d
macOS: move search result counter inside text field
Move the search result counter (e.g. "1/30") inside the search text
field using an overlay, preventing layout shift when results appear.

This PR was authored with Claude Code.
2025-11-26 13:04:05 -05:00
Mitchell Hashimoto 5b4394d211
macos: end_search for ending search 2025-11-26 08:57:24 -08:00
Mitchell Hashimoto c51170da9c
add end_search binding 2025-11-26 08:50:06 -08:00
Mitchell Hashimoto f7b14a0142
macos: debounce search requests with length less than 3 2025-11-26 08:50:06 -08:00
Mitchell Hashimoto 339abf97f7
macos: can allow single char searches now 2025-11-26 08:50:06 -08:00
Mitchell Hashimoto 1bb2d4f1c2
macos: only end search if we previously had one 2025-11-26 08:50:05 -08:00
Mitchell Hashimoto 93656fca5a
macos: show progerss correctly for search 2025-11-26 08:50:05 -08:00
Mitchell Hashimoto 0e974f85ed
macos: fix iOS build 2025-11-26 08:50:05 -08:00
Mitchell Hashimoto c20af77f98
macos: handle search progress/total apprt actions 2025-11-26 08:50:05 -08:00
Mitchell Hashimoto d4a2f3db71
macos: search overlay shows search progress 2025-11-26 08:50:05 -08: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
Mitchell Hashimoto 949a8ea53f
macos: dummy search state for iOS 2025-11-26 08:50:05 -08:00
Mitchell Hashimoto cfbc219f5c
macos: enter and shift+enter move the results 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto efc05523e0
macos: enter goes to next result 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto 3ce19a02ba
macos: hook up the next/prev search buttons 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto ad8a6e0642
search thread needs to take an allocated needle 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto 5ee000f58f
macos: search input starts the search up 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto 081d73d850
macos: changes to SearchState trigger calls to internals 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto 56d4a7f58e
macos: start_search refocuses the search input 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto c61d28a3a4
macos: esc returns focus back to surface 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto b7e70ce534
apprt: end_search 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto bc44b187d6
macos: hook up start_search apprt action to open search 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto b87d57f029
macos: search overlay 2025-11-26 08:50:03 -08:00
Lukas 2a627a4665
macOS: fix the animation of showing&hiding command palette 2025-11-25 11:22:14 +01:00
Vinícius Soares 92aa960381 Add flag for quick terminal 2025-11-23 12:43:11 -03:00
Lukas 6f75cc56f6
macOS: Only change the icon if needed
Fixes #9666
2025-11-22 16:48:39 +01:00
Lukas 2f1427f529
macOS: match scroller’s appearance with surface’s background 2025-11-17 18:20:24 +01:00
Lukas 011fc77caa
macOS: Fix dictation icon's position while speaking 2025-11-16 12:17:31 +01:00
Mitchell Hashimoto caf5040a6d
macOS: find correct tab bar when in fullscreen (#9596)
Fixes #9597
2025-11-15 14:13:30 -08:00
Lukas 8d1dd332c6
macOS: fix misplaced frame modifier
As per #9504, this was supposed to be on `ZStack`, not on the overlay. See also #9503. I cherry-picked it in the wrong place before.
2025-11-15 10:14:43 +01:00
Lukas b124b78313
macOS: find correct tab bar when in fullscreen
Fixes #9593
2025-11-15 08:10:05 +01:00
Daniel Wennberg 49bf73458b don't autohide scrollers 2025-11-14 07:40:51 -08:00
Daniel Wennberg d48f855a48 macOS: set scrollbar size to .small 2025-11-14 07:36:54 -08:00
Mitchell Hashimoto 5ab23e6493
macOS: restore visiblity state when hiding quick terminal (#9576)
Fixes #8414 and a case where `toggle_visibility` is not working after
hiding using `cmd+h`


https://github.com/user-attachments/assets/be28c2d9-b416-467f-9fe9-7b7c97278330
2025-11-14 07:29:46 -08:00
Lukas 1486be0cdf
macOS: add more cursor style and fixes #8409 2025-11-13 18:20:09 +01:00
Lukas bcb5112b24
macOS: restore visiblity state when hiding quick terminal 2025-11-13 11:30:43 +01:00
Mitchell Hashimoto eff3619878
macos: Require fullScreenMode on fullscreenStyle 2025-11-11 09:21:15 -08:00
Lukas 2debeb0f13
macOS: save effective fullscreen styles 2025-11-11 18:16:40 +01:00
Lukas 8437be8ee1
macOS: 'restore' non native fullscreen styles 2025-11-11 18:11:15 +01:00
Mitchell Hashimoto 791d8f8200
macos: add a "restart later" option to the installing state 2025-11-11 07:27:03 -08:00
Lukas f5bddb346c
macOS: support `close_all_windows` action 2025-11-10 17:54:46 +01:00
Lukas 7ca858d404
macOS: move focus if command palette is not showing 2025-11-10 10:11:34 +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
Lukas 52d3329f84
macOS: use unobtrusive when quick terminal is visible 2025-11-09 13:32:50 +01:00
Lukas 84082c2b96
macOS: equalize splits when double tapping on SplitView divider (#9524)
Resolves Issue #8357 

### Implementation

Following the existing `onResize` callback pattern in
`TerminalSplitTreeView`, I added an `onEqualize` callback to
`SplitView`. When a divider is double-tapped, the callback retrieves a
surface from that `TerminalView`'s `SplitTree` and calls `splitEqualize`
to equalize the entire tree.

### Context

There is an existing PR #8364 that implements this feature but uses
`focusedSurface`, which doesn't work for unfocused windows. Since that
PR has been inactive for a few months after requested changes, I've
implemented this alternative approach.

Credit to @liby for that initial implementation!

### AI Usage

I chatted with Claude Code in Plan mode to understand the relationship
between surfaces and the split tree/split views, but I wrote all the
code myself.

### Screenshot


https://github.com/user-attachments/assets/0efd70ef-c90e-4b50-b853-b05e2ca2be67
2025-11-09 09:07:09 +01:00
Daniel Wennberg e3ff49e653 macOS: Update core surface size when config changes 2025-11-08 23:34:56 -08:00
Sean Kelly e298620828 macOS: equalize splits when double tapping on SplitView divider 2025-11-08 23:16:16 -08:00
Daniel Wennberg 5845a7bd29 macOS: Update core surface size when scroller style changes 2025-11-08 22:41:59 -08:00
Daniel Wennberg 3142c5aa60 macOS: Don't clip surfaceView to contentView
Fixes #9248
2025-11-08 09:34:02 -08:00
Mitchell Hashimoto 12c8b6c1aa
macOS: Refactor scrollview to preserve state across split tree changes (#9446)
Fixes #9444
2025-11-07 15:10:45 -08:00
Mitchell Hashimoto 04563a16b6
macos: simplify the code to a more understandable style 2025-11-07 14:24:56 -08:00
Lars 1eecd448e9 remove needsConfirm 2025-11-07 14:16:10 -08:00
Lars f94cb01ec8 macOS: attach close confirmation alert to the first window that actually needs it 2025-11-07 14:16:10 -08:00
Lars 3f20f153c5 macOS: fix undo new tab will cause a crash 2025-11-07 14:14:44 -08:00
Mitchell Hashimoto f54c3d9209
macOS: set the macos-icon from a separate thread (#9485)
Closes #8793
2025-11-06 09:55:57 -07:00
Mitchell Hashimoto ec2ef5cf21
macOS: fix Dictation icon starting above the text, not below (#9488)
Partially fixes #8493.

After dictating some texts, the icon still appears above, but it will
return to its right position after resizing or `\n` (saying newline, not
hitting enter).

This behaviour is better than before, where the icon always appeared
above.

> Quicklook doesn't seem to call this on Tahoe, but it still works well
anyway.

### Reference:


9e905357bb/src/nsterm.m (L7426)



https://github.com/user-attachments/assets/6bf818c3-a0bb-412f-ae06-673f67cdeae4
2025-11-06 09:55:36 -07:00
Lars c8c36a6035
macOS: fix funky resolution in quick terminal 2025-11-06 16:13:05 +01:00
Lars 98ae1dbd10
macOS: fix Dictation icon starting above the text, not below
Partially fixes #8493.

After dictating some texts, the icon still appears above, but it will return to its right position after resizing or `\n` (saying newline, not hitting enter).

This behaviour is better than before, where the icon always appeared above.

### Reference:

9e905357bb/src/nsterm.m (L7426)
2025-11-05 18:22:08 +01:00
Lars 7472fb7732
macOS: set the macos-icon from a separate thread 2025-11-05 12:27:35 +01:00
Daniel Wennberg afc64f6285 Refactor scrollview to preserve state across split tree changes 2025-11-04 00:02:21 -08:00
Daniel Wennberg 9002c5dbd2 Preserve surface content size across backing updates 2025-11-04 00:02:21 -08:00
Daniel Wennberg d678e2e305 Use notifications to deal with NSScrollPocket 2025-11-04 00:02:21 -08:00
Mitchell Hashimoto 901708e8da
input: write_*_file actions take an optional format
Fixes #9398
2025-10-31 09:49:59 -07:00
Daniel Wennberg 951374cd1c Fix documentView padding calculations 2025-10-31 00:39:03 -07:00
Mitchell Hashimoto 5c1f036613
macos: assert only one text-plain gets written to clipboard 2025-10-30 15:16:15 -07:00
Mitchell Hashimoto 0f1c46e4a4
macos: support setting multiple clipboard content types 2025-10-30 14:01:58 -07:00
Lukas c7d5d1b9fc
macOS: make text editor in clipboard confirmation non focusable (#9400)
With its being `focusable`(default), the first responder became the text
editor instead of the paste button.

This fixes the issue where one can't confirm with the keyboard.

This doesn't affect its selection.
2025-10-29 21:30:03 -07:00
Daniel Wennberg 88444d4bd7 macOS: Adjust documentView padding on layout changes 2025-10-27 10:43:47 -07: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
Lukas fd969b53a5
macOS: fix #8282 (#9343)
After `ghostty_app_update_config`, `ghostty_action_config_change_s` was
fired with the correct config. This happens synchronously, which will
update `App.config` in `App.configChange(_:target:v:)`.

Previously, after updating, `App.config` was set with the stale one,
which caused #8282.
2025-10-25 20:08:32 -07:00
Lars d39cc6d478
macOS: update window appearance based on `preferredBackgroundColor` 2025-10-25 19:35:34 +02:00
Mitchell Hashimoto 5c574e7745
macos: use TextEditor instead of Text for clipboard confirmation (#9324)
Fixes #9322

SwiftUI `Text` has huge performance issues. On my maxed out MBP it hangs
for any text more than 100KB (it took ~8s to display it!). `TextEditor`
with a constant value works much better and handles scrolling for us,
too!
2025-10-23 09:22:35 -07:00