26 Commits

Author SHA1 Message Date
Damien Mehala
011c17da41 fix: quick terminal CPU spikes
Fixes #3998
2024-12-30 07:24:35 -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
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
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
63b11ceb5e macos: quick terminal set colorspace 2024-10-31 09:29:14 -07: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
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
df7120d130 macos: use notification to detect when quick terminal shows/hides
Fixes #2474
2024-10-23 10:14:11 -07:00
Mitchell Hashimoto
94d30eaea3 macos: retry focusing the quick terminal to handle focus on other screen
Fixes #2409

This is one of the weirder macOS quirks (bugs? who knows!) I've seen
recently. The bug as described in #2409: when you have at least two
monitors ("screens" in AppKit parlance), Ghostty on one, a focused app
on the other, and you toggle the quick terminal, the quick terminal
does not have focus.

We already knew and accounted for the fact that
`window.makeKeyAndOrderFront(nil)` does not work until the window is visible
and on the target screen. To do this, we only called this once the
animation was complete. For the same NSScreen, this works, but for
another screen, it does not.

Using one DispatchQueue.async tick also does not work. Based on testing,
it takes anywhere from 2 to 5 ticks to get the window focus API to work
properly. Okay.

The solution I came up with here is to retry the focus operation every
25ms up to 250ms. This has worked consistently for me within the first 5
ticks but it is obviously a hack so I'm not sure if this is all right.

This fixes the issue but if there's a better way to do this, I'm all
ears!
2024-10-09 15:13:54 -07:00
Mitchell Hashimoto
163e6cccca macos: quick terminal window blur settings take effect properly
Fixes #2410
2024-10-07 14:58:47 -10:00
Mitchell Hashimoto
78b9636d15 macos: apply background opacity to quick terminal
Fixes #2331
2024-09-30 21:18:47 -07:00
Mitchell Hashimoto
46cbe59076 macos: quick terminal supports fullscreen
Fixes #2330

The quick terminal now supports fullscreen. The fullscreen mode is
always non-native due to the quick terminal being a titleless, floating
window.

When the quick terminal loses focus and animates out, it will always
exit fullscreen mode.
2024-09-30 21:07:16 -07:00
Mitchell Hashimoto
7a5a9c2a58 macos: quick terminal app activation tweaks to avoid bringing up other windows
Fixes #2336

The comments explain the issues here.
2024-09-30 20:45:54 -07:00
Mitchell Hashimoto
19012cb6f5 macos: quick terminal restores focus to previous application 2024-09-29 15:33:12 -07:00
Mitchell Hashimoto
c70e0b2634 macos: use orderOut which handles all of our focus logic for us 2024-09-29 15:06:54 -07:00
Mitchell Hashimoto
c8a40a7791 macos: quick terminal close focuses next window on same screen/space
Previously, we'd find the next Ghostty window anywhere. Now we find the
one on the same screen/space to avoid moving the focus to a different screen.
2024-09-29 14:56:03 -07:00
Mitchell Hashimoto
83505bb4c0 macos: ensure quick terminal becomes key and focused after animation in 2024-09-29 10:44:16 -07:00
Mitchell Hashimoto
e47e7a8b8b macos: quick terminal always brings Ghostty to the front 2024-09-29 09:31:56 -07:00
Mitchell Hashimoto
4f9d49b380 macos: handle multiple monitors properly 2024-09-28 20:52:22 -07:00
Mitchell Hashimoto
76a2041cbf macos: make quick terminal animation 0.2 instead of 0.3 2024-09-28 19:11:40 -07:00
Mitchell Hashimoto
1d727320b4 macos: if initializing new surface tree, move focus to it 2024-09-28 19:11:16 -07:00
Mitchell Hashimoto
61dd395251 macos: show alert if new tab is attempted from quick term 2024-09-28 18:46:52 -07:00
Mitchell Hashimoto
13eb8ac6e2 macos: ability to interrupt animation, track it in menu 2024-09-28 15:29:57 -07:00
Mitchell Hashimoto
1570ef01a7 rename slide to quick terminal 2024-09-28 15:20:35 -07:00