Commit Graph

567 Commits

Author SHA1 Message Date
Lukas
d6dfaf28fe macOS: support injecting temporary defaults when testing 2026-03-12 13:16:55 +01:00
Lukas
596d502a75 macOS: restore window frame under certain conditions 2026-03-11 17:45:10 +01:00
Lukas
45d360dc68 macOS: set the initial window position after window is loaded 2026-03-11 17:45:09 +01:00
Lukas
e8c82ca1af macOS: save frame only if the window is visible 2026-03-11 17:45:09 +01:00
Lukas
de0f2ab22d macos: add enum type for macos-titlebar-style 2026-03-10 17:15:14 +01:00
Mitchell Hashimoto
3782d118e1 macOS: restore keyboard focus after inline tab title edit (#11320)
## Summary

- After finishing an inline tab title edit (via keybind or
double-click), all keyboard input is lost because
`TabTitleEditor.finishEditing()` sets `makeFirstResponder(nil)`, leaving
the window itself as first responder with no path back to the terminal
surface.
- Adds a `tabTitleEditorDidFinishEditing` delegate callback to
`TabTitleEditorDelegate` that fires after every edit (commit or cancel).
- `TerminalWindow` implements it by calling
`makeFirstResponder(focusedSurface)` to restore keyboard focus to the
terminal.

Fixes https://github.com/ghostty-org/ghostty/discussions/11315

## Testing

- [x] Bind `prompt_tab_title` to a keybind (e.g. `keybind =
cmd+shift+i=prompt_tab_title`)
- [x] Trigger inline tab title edit via keybind, press Enter — verify
keyboard input works immediately
- [x] Trigger inline tab title edit via keybind, press Escape — verify
keyboard input works immediately
- [x] Double-click a tab title, press Enter — verify keyboard input
works immediately
- [x] Double-click a tab title, press Escape — verify keyboard input
works immediately
- [x] Verify Cmd+number tab switching works after all of the above
- [x] Verify split pane focus is correct after editing tab title with
splits open

AI disclosure: Codebase exploration and review via [Claude
Code](https://claude.com/claude-code)
2026-03-10 08:59:51 -07:00
chronologos
7629130fb4 macOS: restore keyboard focus after inline tab title edit
After finishing an inline tab title edit (via keybind or double-click),
`TabTitleEditor.finishEditing()` calls `makeFirstResponder(nil)` to
clear focus from the text field, leaving the window itself as first
responder. No code path restores focus to the terminal surface, so all
keyboard input is lost until the user clicks into a pane.

Add a `tabTitleEditorDidFinishEditing` delegate callback that fires
after every edit (commit or cancel). TerminalWindow implements it by
calling `makeFirstResponder(focusedSurface)` to hand focus back to the
terminal.

Fixes https://github.com/ghostty-org/ghostty/discussions/11315

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-10 08:52:00 -07:00
Lukas
a6cd1b08af macOS: fix intrinsicContentSize race in windowDidLoad (#11256)
Add initialContentSize fallback on TerminalViewContainer so
intrinsicContentSize returns the correct value immediately,
without waiting for @FocusedValue to propagate. This removes
the need for the DispatchQueue.main.asyncAfter 40ms delay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 15:35:49 +01:00
Mitchell Hashimoto
a6ee1fb292 macos: increase window-width/height apply delay from 10ms to 40ms
Band-aid for #10304

We don't have a robust fix yet but this should help mitigate more
scenarios.
2026-03-09 08:42:07 -07:00
Mitchell Hashimoto
dd3d72c3de Revert "macOS: filter proper intrinsicContentSize when opening new window (#11257)"
This reverts commit 3445c9afda, reversing
changes made to 1e981f858a.
2026-03-09 08:33:24 -07:00
Lukas
3c93c35869 macOS: filter proper intrinsicContentSize when opening new window
Fixes #11256
2026-03-09 08:21:29 -07:00
Lukas
df4d9bc0d0 macos: fix quick terminal glassy background 2026-03-08 15:22:37 +01: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
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
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
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
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
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
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
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
2d6fa92d78 macos: swiftlint 'for_where' rule 2026-02-20 19:42:48 -05:00
Jon Parise
e887527e59 macos: swiftlint 'unused_enumerated' rule 2026-02-20 08:03:05 -05:00
Jon Parise
dbf2e0e087 macos: swiftlint 'vertical_parameter_alignment' rule 2026-02-19 19:11:36 -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
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
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
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
56d67ce88f macos: swiftlint 'control_statement' rule 2026-02-19 18:34:37 -05:00