Fixes#734
I don't know much about SwiftUI, but here's why I think this works.
- Moving the `inspectorVisible` logic to an `onChange` ensures the view
has at least seen that change.
- The dispatch to the main thread is still necessary to ensure the view
hierarchy has completely updated after `inspectorVisible`.
Note that this fix is to correctly regain focus. We still lose window
focus very briefly.
Fixes#1833
This is an attempt to simplify the logic that has organically grown
convoluted over time with regards to how the titlebar and tab bar is
styled.
This field is one unified field that ONLY addresses titlebar and tab bar
styling. It can be one of "native", "transparent", or "tabs". The
"native" field is the new behavior in this commit: it makes the titlebar
and tab bar appearance be absolutely native. We do not color anything
(if we do its a bug).
The "transparent" option is the previous `macos-titlebar-tabs = false`
setting where the titlebar/tab bar is native but colored according to
the window background color.
The "tabs" option is `macos-titlebar-tabs = true`.
The `window-theme = auto` affect on titlebar appearance has been
removed. Now, the titlebar will NEVER be styled with "native" and MAY be
styled with "transparent" and will ALWAYS be styled with "tabs" (since
that's a totally custom look anyways).
Fixes#1802
This allows `keybind` configurations to map to any Unicode codepoint. This enables keybindings for which we don't have a registered keycode or for custom keyboard firmwares that may produce arbitrary text (but the Ghostty support is limited to a single codepoint).
The `keybind` syntax is unchanged. If a bound character doesn't map to a known logical key that Ghostty knows about, we map it to a Unicode codepoint. The unicode codepoint is compared against the _unshifted codepoint_ from the apprt key event.
Note that this binding is to a single _codepoint_. We don't support arbitrary sequences of characters or multi-code point graphemes for keybindings due to the complexity in memory management that would introduce.
This also provides a good fallback for scenarios where it might make sense to educate Ghostty about a key code or fix a bug in our keyboard input system, but the unicode data is correct. In that scenario, unicode key binds should allow key binds to still work while we investigate the input issues.
Example:
```
shift+ö=text:hello
```
This now works as expected on a US hardware keyboard with the Hungarian keyboard layout.
Fixes#1756
We previously converted from view to screen coordinates but if the view
doesn't take up the full window then the view coordinates are wrong. We
need to convert to window coordinates in the middle.
Add support for configurable fonts for window and tab titles. This is
only implemented for macOS (and could be macOS-only if other platforms
aren't able to support this using their windowing toolkits). It plays
nicely with regular and titlebar tabs.
Previously files would be pasted as only the filename. This commit
introduces an extension to NSPasteboard which provides a method to
consistently get the string contents of a pasteboard so that the
behavior can stay the same anywhere where we need to do that.
Fixes#1500
This overhauls how we do focus management for surfaces to make it more
robust. This DID somehow all work before but was always brittle and was
a sketchy play with SwiftUI/AppKit behavior across macOS versions.
The new approach uses our window controller and terminal delegate
system to disseminate focus information whenever any surface changes
focus. This ensures that only ONE surface ever has focus in libghostty
because the controller ensures it is widely distributed.
We are also now using the `darken(by:)` implementation to generate
the split divider color on macOS, which means we'll have a consistent
rendering across iOS and macOS.
Fixes#1330
I admit this code is a mess to understand, so I'm not 100% certain this
fix is correct. It definitely fixes#1330 but I'm not sure if this
breaks other split scenarios.
I believe that our logic here was simply wrong, notice that left/right
had opposite logic and this brings it all into consistency.
Long term, we should redo all of our directional movement since we've
refactored how split state is stored now on the controller with parent
references.
This allows for example clicking on a split when focused on a different
app and having focus immediately jump to that split. Before this, you'd
have to click to focus the window, then second click to focus on the
split.