256 Commits

Author SHA1 Message Date
Mitchell Hashimoto
067db2af18
Merge pull request #1858 from SkamDart/focus-follows-mouse
feat: focus follows mouse for splits
2024-06-18 17:09:54 -04:00
Mitchell Hashimoto
50019bc766
minor comment changes 2024-06-18 17:09:29 -04:00
Robbie Vanbrabant
693a599084 macos: regain window focus on inspector toggle
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.
2024-06-14 19:22:50 +01:00
Cameron Dart
92e16ccbf7 no early return 2024-06-10 18:23:06 -07:00
Cameron Dart
29fb70197c macos: surface focus follow mouse 2024-06-10 16:07:33 -07:00
Cameron Dart
97bb595505 macos: add to config 2024-06-10 16:06:57 -07:00
Mitchell Hashimoto
5092cb55ad
Merge pull request #1837 from ghostty-org/titlebar-style
macos: macos-titlebar-style, remove titlebar-tabs option
2024-06-07 13:15:14 -07:00
Mitchell Hashimoto
550a9be241
config: introduce macos-window-shadow 2024-06-07 12:46:14 -07:00
Mitchell Hashimoto
25484d2ccc
macos: set background opacity/blur on window controller not surface 2024-06-07 12:31:45 -07:00
Mitchell Hashimoto
4dde7edfab
config: macos-titlebar-style, remove titlebar-tabs option
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).
2024-06-07 12:12:48 -07:00
Mitchell Hashimoto
14417d2592
Allow keybinding arbitrary unicode codepoints (#1814)
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.
2024-06-02 10:53:36 -07:00
Mitchell Hashimoto
d2adf0501c
macos: ime coordinate needs to be converted from view to window coords
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.
2024-05-10 20:45:51 -07:00
Qwerasd
5df0935f82 update font_size to f32 in libghostty 2024-05-09 00:03:40 -04:00
Mitchell Hashimoto
ca9689be46
renderer/metal: API to handle macOS display ID changing 2024-05-04 19:40:58 -07:00
Mitchell Hashimoto
e31e25f54d
apprt/embedded: add draw now API 2024-05-04 14:49:49 -07:00
Mitchell Hashimoto
41cffd116a
Merge pull request #1484 from jparise/window-title-font
macos: configurable titlebar fonts
2024-03-28 09:49:19 -07:00
Mitchell Hashimoto
9aadf59ab1
macos,libghostty: font size is a u8 2024-03-27 20:53:03 -07:00
Jon Parise
baf75dfaaf macos: configurable titlebar fonts
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.
2024-03-26 16:56:39 -07:00
Mitchell Hashimoto
6854fe91ab
macos: only process key equivalents if we're focused
Fixes #1581
2024-03-15 14:11:46 -07:00
Qwerasd
bd03b19679 style 2024-03-08 13:24:01 -05:00
Qwerasd
d1ac0aff39 feat(macOS): Paste copied files as absolute paths.
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.
2024-03-07 20:53:48 -05:00
Mitchell Hashimoto
118b51157a
macos: more robust surface focus state detection
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.
2024-02-11 09:19:13 -08:00
Qwerasd
cf2968c186 fix(macOS): Prevent janky transition animation on DPI change 2024-02-05 15:48:02 -05:00
Qwerasd
7a4c97329e macOS: Add URL to documentation in comment 2024-02-05 15:41:33 -05:00
Qwerasd
e91e2d409b fix(macOS): Prevent incorrect scaling of the Metal layer after DPI change
Ref: https://developer.apple.com/library/archive/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html#//apple_ref/doc/uid/TP40012302-CH10-SW27
2024-02-05 14:08:12 -05:00
Mitchell Hashimoto
62785d9e54
macos: report color scheme for surface to libghostty 2024-02-02 13:19:46 -08:00
Mitchell Hashimoto
50125c0319
macos: whitespace 2024-01-31 15:44:34 -08:00
Mitchell Hashimoto
939bb22615
macos: do not hardcode true for titlebar tabs 2024-01-31 10:22:09 -08:00
Mitchell Hashimoto
fbac2d9810
macos: titlebar tab logic shuffling 2024-01-31 10:08:05 -08:00
Qwerasd
ba16d65d02 macOS: Added titlebar tabs 2024-01-30 18:48:36 -05:00
Pete Schaffner
63cc7dbe0d Move color extensions into OSColor
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.
2024-01-30 22:36:52 +01:00
Pete Schaffner
c248441057 Add ability to color the split divider on iOS
This adds the needed UIColor extensions to achieve the equivalent of
what we did on macOS
2024-01-30 14:31:25 +01:00
Mitchell Hashimoto
411a757cdf
macos: fix uikit build, NSColor is not available 2024-01-29 22:23:06 -08:00
Mitchell Hashimoto
18dfb642f5
macos: plumb through the split divider color 2024-01-29 21:32:10 -08:00
Pete Schaffner
375df57155 Tint split view divider based on theme background 2024-01-29 21:58:13 +01:00
Mitchell Hashimoto
81532c0b56
macos: support reading service result text into terminal 2024-01-21 17:26:41 -08:00
Mitchell Hashimoto
4dbd10c913
apprt/embedded: support asking for selection text, existence 2024-01-21 17:22:44 -08:00
Mitchell Hashimoto
4c9fc452b6
macos: register that we accept/send text types for services 2024-01-21 17:07:24 -08:00
Mitchell Hashimoto
cc01049d55
macos: select split above/below should go to correct split when nested
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.
2024-01-19 21:11:20 -08:00
Mitchell Hashimoto
fd782746d4
macos: set proper content size for UIView views 2024-01-18 20:26:42 -08:00
Mitchell Hashimoto
487c22011c
macos: make SurfaceView cross-platform! 2024-01-18 19:28:36 -08:00
Mitchell Hashimoto
01afa293c8
apprt/embedded: fix initialization on macOS 2024-01-18 08:55:03 -08:00
Mitchell Hashimoto
2568b4979b
macos: allow first click when non-focused to shift focus
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.
2024-01-17 20:30:34 -08:00
Mitchell Hashimoto
ed3f1df5f0
Merge pull request #1316 from qwerasd205/macos-file-handler
Added macOS file open handler
2024-01-16 18:56:34 -08:00
Mitchell Hashimoto
1005116f03
macos: detect error during surface initialization and render 2024-01-16 18:50:47 -08:00
Qwerasd
51f53aa9bf Added macOS file open handler 2024-01-16 16:26:21 -05:00
Mitchell Hashimoto
b806b45bae
macos: use UIColor for iOS 2024-01-16 11:58:14 -08:00
Mitchell Hashimoto
376345dcae
macos: detect renderer health failures and show error view 2024-01-16 11:27:18 -08:00
Mitchell Hashimoto
875a774d4b
macos: remove AppState and unify onto Ghostty.App cross-platform 2024-01-14 19:35:57 -08:00
Mitchell Hashimoto
5e69b30240
macos: iOS Ghostty.App converted to use Ghostty.Config 2024-01-14 15:55:31 -08:00