391 Commits

Author SHA1 Message Date
Mitchell Hashimoto
7eb6b29d4c macos: make auto-update optional (#4436)
When unset, we use Sparkle's default behavior, which is based on the
user's preference stored in the standard user defaults.

The rest of the previous behavior is preserved:
- When SUEnableAutomaticChecks is explicitly false, auto-updates are
disabled.
- When 'auto-update' is set, use its value to set Sparkle's auto-update
behavior.

Fixes #4433
2025-01-02 13:38:15 -08:00
Mitchell Hashimoto
29b96be84f tweaks to window position 2025-01-02 13:18:53 -08:00
Adam Wolf
f9250e28b5 chore: rename window-position-{x,y} to window-initial-position-{x,y} 2025-01-02 12:58:40 -08:00
Adam Wolf
200d0d642b macos: handle setting initial window position when window is created 2025-01-02 12:58:40 -08:00
Adam Wolf
9a58de6d5a feat(macos): allow setting an intial start position 2025-01-02 12:58:40 -08:00
Jon Parise
713dd24ab9 macos: make auto-update optional
When unset, we use Sparkle's default behavior, which is based on the
user's preference stored in the standard user defaults.

The rest of the previous behavior is preserved:
- When SUEnableAutomaticChecks is explicitly false, auto-updates are
  disabled.
- When 'auto-update' is set, use its value to set Sparkle's auto-update
  behavior.
2025-01-02 15:53:01 -05:00
Mitchell Hashimoto
9503c9fe50 Rename goto_split top/bottom directions to up/down. (#3427)
Renames the top/bottom directions of `goto_split` to up/down. I have
tested this on linux (nixos) but given that `goto_split` is broken on
linux anyway (#2866) there's not a whole lot to test.

I have no way to build on macOS so I can't verify that I've changed
everything correctly for that.

Closes #3237
2025-01-02 07:08:16 -08:00
Damien Mehala
ade07c4c3c fix: quick terminal focus-follows-mouse behaviour
Quick Terminal now focuses on the surface under the mouse
pointer when `focus-follows-mouse` is enabled.

Fixes #3337
2024-12-30 11:04:21 -08:00
Daniel Patterson
8cbf8d5003 Fix broken macOS changes 2024-12-27 16:16:30 +00:00
Daniel Patterson
a4daabb28a Rename goto_split top/bottom directions to up/down. 2024-12-27 14:56:48 +00:00
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
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
298d6194f4 config: change color to a defined C struct for libghostty 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
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
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
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
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
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
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
954c4d7b56 macos: swap out pointerVisible with NSCursor.setHiddenUntilMouseMoves
Fixes #2695

We had various issues with the pointerVisible property on macOS,
including the pointer not being hidden when it should be. Our only use
case today is mouse hide while typing so
NSCursor.setHiddenUntilMouseMoves is a better fit!
2024-11-15 19:05:51 -08:00
Jon Parise
dab3c68311 macos: use a constant for the corner radius 2024-11-15 11:19:00 -05:00
Jon Parise
69f396c252 macos: only round the opposing corner
Also, removing the padding from the window edge.
2024-11-15 11:16:25 -05:00
Jon Parise
07bff5f06d macos: reduce the corner radius to 3 pixels 2024-11-15 10:15:48 -05:00
Jon Parise
d9c9f44d6e macos: add rounded corners to the URL hover view
Also pad the view's position from the corners of the surface.
2024-11-15 09:27:42 -05:00
Mitchell Hashimoto
4d00babbea ios surface view needs pwd field 2024-11-13 13:26:32 -08:00
Mitchell Hashimoto
4d9143f634 macos: use the pwd apprt action to set the proxy icon URL 2024-11-13 13:11:32 -08:00
Mitchell Hashimoto
f6ea15dd21 macos: allow additional modifiers through for ctrl+enter
The bug: ctrl+shift+enter on macOS 15 shows a context menu and doesn't
encode to the terminal.

This avoids a system-wide keybind that shows a context menu in macOS
15+. In general Ghostty doesn't try to override system-wide keybinds
but this one is particularly annoying and not useful to terminal users.

We've discussed making this logic configurable for all system level
keybinds but for now this is a quick fix specifically for
ctrl+shift+enter.
2024-11-11 10:13:31 -08:00
Mitchell Hashimoto
30e95e4b9a Revert "macos: setup colorspace in base terminal controller"
This reverts commit e64b231248f68b2fd1e19d538d243b886d5284ff.
2024-10-31 09:28:08 -07:00
Mitchell Hashimoto
e64b231248 macos: setup colorspace in base terminal controller
Fixes #2519

This sets up the colorspace for terminal windows in the base controller.

This also modifies some of our logic so its easier for subclasses of
base controllers to specify custom logic when the configuration reloads,
since that's likely to be a common thing.
2024-10-30 20:35:13 -04:00
Mitchell Hashimoto
1065359b9a apprt: rename set_bg/fg to "color_change" to report all color changes 2024-10-30 16:33:18 -04:00
Mitchell Hashimoto
734c8cec55 Merge pull request #2490 from futurepaul/quick-terminal-improvements
macos: quick terminal animate duration
2024-10-25 20:48:40 -07:00
Mitchell Hashimoto
3c8fc86d6f small rename 2024-10-25 19:23:17 -07:00
Paul Miller
f4ba95b2c5 add quick-terminal-animate-duration option 2024-10-25 19:17:38 -05:00
Mitchell Hashimoto
28751ae5b8 Merge pull request #2485 from axdank/move_current_Tab
gui: add move_current_tab action
2024-10-25 14:15:16 -07:00
Mitchell Hashimoto
de5ec5d83e macos: make move_tab work 2024-10-25 11:54:07 -07:00