843 Commits

Author SHA1 Message Date
Trevor Elkins
c1f61b4344 one more 2024-12-26 17:48:14 -05:00
Trevor Elkins
5867fe425f Move notification handling outside of the current render loop 2024-12-26 17:44:06 -05:00
Mitchell Hashimoto
4e47b2ab6b macos: send a cursor position event on mouseEnter
Fixes #3117

On mouseExit we sent a cursor position event with (-1, -1). Negative
values are meant to indicate that the cursor is not on the surface. The
magnitude of the values are irrelevant. However, we never reset the
cursor position on mouseEnter.

This has the effect of the previous cursor position being stuck outside
the viewport which makes certain things such as `button` mouse reporting
not report until the mouse is moved.

This commit sends the correct cursor position event on mouseEnter.
2024-12-26 07:16:43 -08:00
Damien Mehala
44459e93d1 code review 2024-12-25 00:07:12 +01:00
Damien Mehala
1497e90f95 feat: add support for middle position in quick terminal
This update introduces the ability to launch the quick terminal
in the middle position.

Resolves #2494
2024-12-24 14:58:40 +01:00
Mitchell Hashimoto
53ac0aa975 macos: update content scale whenever the screen changes
Related to #2731

I'm not fully sure if this will fix this issue since I can't reproduce
it but I don't see a downside to doing this and it might fix it.
2024-12-23 13:02:22 -08:00
Mitchell Hashimoto
9d6b9d78d8 macos: set NSAppearance on windowDidLoad
Fixes #3072

Previously, when `window-theme = auto`, the appearance was delayed
enough on the DispatchQueue that the window was already visible. This
would result in the window appearing with the wrong appearance before
switching to the correct one.

For annoying reasons, we can't set the NSApplication.shared.appearance
in `applicationDidFinishLaunching` because it results in a deadlock with
AppKit.

This commit moves to set the `NSWindow.appearance` in `windowDidLoad`
(and any config sync) to ensure that the appearance is set before the
window is visible.

This is probably the right solution anyways because this allows windows
with different background colors to each have their own distinct
appearance.
2024-12-22 19:33:01 -08:00
Mitchell Hashimoto
1861a391c8 config: quick terminal auto hide (#3059)
## Description

Introduce a setting allowing to customize the behavior of the quick
terminal when it loses focus. By default, the quick terminal will
automatically hide. However, you can now configure it to remain open by
setting `quick-terminal-autohide: false`.

Resolves #2558
2024-12-22 07:06:10 -08:00
Troels Thomsen
0611ca414f Divide red component of unfocused split fill color 2024-12-22 09:59:15 +01:00
Mitchell Hashimoto
1f468202d4 macos: add macos-icon-frame and some custom frame styles 2024-12-21 19:48:24 -08:00
Mitchell Hashimoto
abf713feec macos: support the macos-icon configurations 2024-12-21 19:31:30 -08:00
Mitchell Hashimoto
29929a473d config: macos-icon configurations 2024-12-21 19:31:30 -08:00
Mitchell Hashimoto
298d6194f4 config: change color to a defined C struct for libghostty 2024-12-21 19:31:30 -08:00
Mitchell Hashimoto
adba2036e3 macos: custom app icon goes into About window 2024-12-21 19:31:30 -08:00
Mitchell Hashimoto
c4bec781b0 macos: colorized Ghostty icon begins! 2024-12-21 19:31:30 -08:00
Damien MEHALA
196af6f2ca config: quick terminal auto hide
Introduce a setting allowing to customize the behavior of the quick terminal
when it loses focus. By default, the quick terminal will automatically hide.
However, you can now configure it to remain open by setting
`quick-terminal-autohide: false`.

Resolves #2558
2024-12-22 01:08:47 +01:00
Mitchell Hashimoto
8f15f1a066 Make Ghostty release channel aware
Ghostty now has a release channel build configuration. Current valid
values are "tip" and "stable" but I imagine more will be added in the
future.

The release channel is inferred whether the version we specify with the
`-Dversion-string` build flag has a prerelease tag or not. If it does,
the release channel is "tip". If it doesn't, the release channel is
"stable".

This also adds a configuration to specify the release channel for
auto-updates for the macOS application.
2024-12-20 14:21:59 -08:00
Mitchell Hashimoto
0abd4ea8a2 ci: release tag workflow
This adds a new workflow for building and releasing _tagged versions_
of Ghostty. The workflow is triggered automatically by new tags in the
format of `vX.Y.Z` but can also be manually triggered by running the
workflow from the GitHub Actions UI.

Release artifacts are uploaded to a completely separate R2 bucket
with its own access policy, retention, API keys, and so on.

There is currently no way to switch between "channels" in the macOS
app. I will follow up with a separate commit to add this feature.
2024-12-20 13:02:05 -08:00
Mitchell Hashimoto
330bbd0502 macos: add "Docs" button to the About window 2024-12-20 09:11:04 -08:00
Mitchell Hashimoto
c74966e07e build: change object story domain to ghostty.org 2024-12-20 08:58:46 -08:00
Jon Parise
717425ca07 macos: add zsh to the application bundle 2024-12-16 19:40:31 -05:00
Jon Parise
f81bb892c0 macos: add bash-completion to the application bundle 2024-12-16 08:38:55 -05:00
Mitchell Hashimoto
4fdf5eb12b macos: move title setting into a function to better encapsulate 2024-12-12 16:43:22 -08:00
Pranav Mangal
e35bd431f4 Move title change timer to SurfaceView and call it from Ghostty.App instead of terminal controllers 2024-12-12 14:58:42 +05:30
Pranav Mangal
146b1f2a1b Add delay before a title change to avoid flicker on macOS 2024-12-12 13:18:15 +05:30
Mitchell Hashimoto
63f77f0c9f macos: fix unwanted resize in non native fullscreen (#2901)
Fixes #2516 

Those changes mean that when we have one ghostty window in non-native
fullscreen and another ghostty window not in fullscreen switching to not
fullscreen window won't cause appearing menu bar and dock. I think it
looks good:
![Screenshot 2024-12-07 at 19 18
33](https://github.com/user-attachments/assets/125eb18f-3b2f-469a-a5ba-0469dd12462a)

If we implement detection and make menu bar and dock appear for not
fullscreen window in this case it will cause the fullscreen window to
change its size and will look bad.

Non-native fullscreen works bad with multiple screens in either way.
E.g. switching to a non-native fullscreen window would cause menubar
disappering on another screen or switching to not fullscreen window
would show menu bar over fullscreen window on another screen. I think
nobody would want non-native fullscreen with multiple screens.
2024-12-11 08:52:25 -08:00
Mitchell Hashimoto
247409d705 New Ghostty icon
❤️👻

This is the icon that we'll launch Ghostty 1.0 with. It was designed by
Michael Flareup at PixelResort. It retains the style of the original
Ghostty icon by Alasdair Monk, but brings in the new Ghost character and
adds details that make it more Apple-like.

The new Ghost character is an important evolution from the original
since it separates us from looking too much like PacMan. The new Ghost
is more unique and recognizable to Ghostty (or, hopefully will be!).

The icon itself has more details: the aluminum around the edge has
texture for the large enough sizes, there are visible scanlines, the
glow of a screen emanates from the ghost.

The icon itself is stylistic more Apple-like than other platforms. I
think Apple icons tend to look very good in more environments than the
reverse and I'm a big fan of the Apple aesthetic so I wanted to bring
that to Ghostty for all platforms.
2024-12-09 10:01:18 -08:00
Mitchell Hashimoto
1825f5d2d6 macos: make non-native fullscreen windows not resizeable (#2903)
I've noticed that I can resize a non-native fullscreen window when
selecting text to copy. I think it shouldn't be resizeable.
2024-12-08 16:35:00 -08:00
Dmitry Zhlobo
49f105cd27 macos: make non-native fullscreen windows not resizeable 2024-12-08 16:34:44 -08:00
Mitchell Hashimoto
eb138930e6 macos: prevent moveFocus from being an infinite loop
Fixes #2900

It's possible for moveFocus to infinite loop if the surface view we're
trying to move focus to NEVER gets attached to a window. This can happen
if the window is destroyed.

I think this issue should be more systemically fixed so it can't happen
but this workaround for now prevents moveFocus from being an infinite
loop source for the time being.
2024-12-08 11:06:00 -08:00
Dmitry Zhlobo
080afce649 found a better explanation for the reason to hide dock before menu 2024-12-08 13:09:37 +01:00
Dmitry Zhlobo
0d0aeccf0f fix unwanted resize of non-native fullscreen window
Removing autoHideDock and autoHideMenuBar options cause window to
resize.

Fix #2516
2024-12-08 13:09:37 +01:00
Mitchell Hashimoto
f384fd038b macos: trigger fullscreenDidChange on any fullscreen event
Fixes #2840
Related to #2842

This builds on #2842 by missing a key situation: when native fullscreen
is toggled using the menu bar items it doesn't go through our
`FullscreenStyle` machinery so we don't trigger fullscreen change
events.

This commit makes it so that our FullscreenStyle always listens for
native fullscreen change (even in non-native modes) to fire a fullscreen
did change event. This way we can always rely on the event to be fired
when fullscreen changes no matter what.
2024-12-01 11:37:04 -08:00
Mitchell Hashimoto
9ac929ef8e macos: unicode keybindings must convert to string properly
Fixes #2848

The proper way to convert a unicode scalar in Swift is to use the
`String` initializer that takes a `UnicodeScalar` as an argument. We
were converting a number to a string before, which is incorrect.
2024-11-29 14:21:46 -08:00
Mitchell Hashimoto
3bf1fdd7de macos: titlebar tabs can find titlebar container in fullscreen
Fixes #2850

In native fullscreen, the titlebar container is no longer part of our
NSWindow and is instead a separate window called
NSToolbarFullScreenWindow. We now search for this window when we are in
native fullscreen.
2024-11-29 10:35:02 -08:00
Mitchell Hashimoto
ba4185f6b7 macos: disable background opacity/blur in native fullscreen
See #2840
2024-11-27 08:35:13 -08:00
Mitchell Hashimoto
cd49015243 App applies conditional state, supports theme setting
The prior light/dark mode awareness work works on surface-level APIs. As
a result, configurations used at the app-level (such as split divider
colors, inactive split opacity, etc.) are not aware of the current theme
configurations and default to the "light" theme.

This commit adds APIs to specify app-level color scheme changes. This
changes the configuration for the app and sets the default conditional
state to use that new theme. This latter point makes it so that future
surfaces use the correct theme on load rather than requiring some apprt
event loop ticks. Some users have already reported a short "flicker" to
load the correct theme, so this should help alleviate that.
2024-11-22 14:08:35 -08:00
Mitchell Hashimoto
958316d851 Merge pull request #2770 from ghostty-org/push-xptpwxwxvwxs
macos: update recommended Xcode settings
2024-11-22 12:37:19 -08:00
Mitchell Hashimoto
523307e958 macos: update recommended Xcode settings
I genuinely don't know what they do, but Xcode recommended it and
cursory docs reading seems to indicate its safe. I don't think it'll
result in any noticeable changes.
2024-11-22 12:00:38 -08:00
Mitchell Hashimoto
0bb4ca269c macos: use Ghostty logger not AppDelegate 2024-11-22 11:53:52 -08:00
Mitchell Hashimoto
a191f3c396 apprt: switch to reload_config action that calls update_config API 2024-11-22 11:52:34 -08:00
Mitchell Hashimoto
ddde68d1f4 macos: add NSAppearance.isDark 2024-11-22 10:31:31 -08:00
Mitchell Hashimoto
a733ea381b macos: OSColor.hexString must be able to compile with UIKit 2024-11-21 14:50:03 -08:00
Mitchell Hashimoto
1aa77837eb macos: use correct title background if top surface 2024-11-21 14:20:31 -08:00
Mitchell Hashimoto
36a57826a6 macos: only color the titlebar of surfaces that border the top 2024-11-21 14:07:39 -08:00
Mitchell Hashimoto
7fb86a3c9c macos: listen for color change property to update window appearance 2024-11-21 13:37:54 -08:00
Mitchell Hashimoto
f722e30bf5 macos: terminal controller reacts to surface config changes 2024-11-21 12:46:46 -08:00
Mitchell Hashimoto
35fcb1a29b macos: change config access to evented, derived config like libghostty
Previously, we would access the `ghostty.config` object from anywhere.
The issue with this is that memory lifetime access to the underlying
`ghostty_config_t` was messy. It was easy when the apprt owned every
reference but since automatic theme changes were implemented, this isn't
always true anymore.

To fix this, we move to the same pattern we use internally in the core
of ghostty: whenever the config changes, we handle an event, derive our
desired values out of the config (copy them), and then let the caller
free the config if they want to. This way, we can be sure that any
information we need from the config is always owned by us.
2024-11-21 11:36:51 -08:00
Mitchell Hashimoto
3afb9065f0 macos: listen for config change and post a notification 2024-11-21 10:30:27 -08:00
Mitchell Hashimoto
3392659e1f Revert "macos: enable Metal shader logging"
This reverts commit aad101565abff3368af76e8c2e93cbe7c278a89f.
2024-11-20 15:01:27 -08:00