49 Commits

Author SHA1 Message Date
Daniel Patterson
a4daabb28a Rename goto_split top/bottom directions to up/down. 2024-12-27 14:56:48 +00: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
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
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
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
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
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
df7120d130 macos: use notification to detect when quick terminal shows/hides
Fixes #2474
2024-10-23 10:14:11 -07:00
Mitchell Hashimoto
ed2cd6d436 macos: remove the ability to bind fn/globe
This was recently introduced a few days ago. Unfortunately, this doesn't
work as expected. The "function" modifier is not actually the fn key
but used by macOS to represent a variety of "functional" key presses.
This breaks other bindings such as #2411.

I can't find a source on the internet that reliably tells me how we
can detect fn key presses, but I do find a number of sources that tell
us we can't.
2024-10-07 14:36:12 -10:00
Mitchell Hashimoto
f9e6d6efa6 macos: forward key events to the app when no windows exist 2024-10-05 10:05:06 -10:00
Mitchell Hashimoto
6fdfa9d491 Make the function/globe key available as a modifier on macOS 2024-10-05 09:39:55 -10:00
Mitchell Hashimoto
9971d7a93d macos: toggle_visibility needs to sync to the correct menu item 2024-10-05 06:05:13 -10:00
Lucy Davinhart
a109b8d755 Implements initial-window=false for macOS
Closes https://github.com/ghostty-org/ghostty/issues/2361
2024-10-03 19:09:37 +01:00
Mitchell Hashimoto
28ec11e52b docs updates 2024-10-02 10:52:59 -07:00
Roland Peelen
af48c1af0c Refactor to hide only BaseTerminalController windows
This also slightly changes the code, as the duplication of the for loop
was making it harder to read now. I think technically slightly less
efficient, but this is hardly a hot code path, so should be fine imo.
2024-10-02 10:33:36 -07:00
Roland Peelen
4aac4ecd98 Add hiding toggle, hook up to menu / shortcut 2024-10-02 10:33:36 -07:00
Mitchell Hashimoto
11d5ec7dc1 config: support quick terminal position 2024-09-28 18:42:25 -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
Mitchell Hashimoto
cadb960ef9 core: slide terminal keybinding action 2024-09-27 18:36:06 -07:00
Mitchell Hashimoto
bdd0070ffd macos: render a terminal in the slide window 2024-09-27 18:36:06 -07:00
Mitchell Hashimoto
93b2fe60f8 macos: start work on SlideTerminal, slides in window from top 2024-09-27 18:36:06 -07:00
Mitchell Hashimoto
4ae20212bf libghostty: unified action dispatch
First, this commit modifies libghostty to use a single unified action
dispatch system based on a tagged union versus the one-off callback
system that was previously in place. This change simplifies the code on
both the core and consumer sides of the library. Importantly, as we
introduce new actions, we can now maintain ABI compatibility so long as
our union size does not change (something I don't promise yet).

Second, this moves a lot more of the functions call on a surface into
the action system. This affects all apprts and continues the previous
work of introducing a more unified API for optional surface features.
2024-09-26 22:00:11 -07:00
Mitchell Hashimoto
6d6052d204 small comment changes 2024-09-24 20:53:45 -07:00
Mitchell Hashimoto
ed7ac8aa21 macos: better enable timing depending on process launch time 2024-09-24 16:38:17 -07:00
Mitchell Hashimoto
1ad904478d Tap events, core API to handle global keybinds 2024-09-24 16:29:02 -07:00
Mitchell Hashimoto
fa9df4f6f0 macos: persist secure input state across restarts 2024-09-19 19:54:53 -07:00
Mitchell Hashimoto
c0e0eff468 core: add toggle_secure_input keybinding 2024-09-19 10:20:30 -07:00
Mitchell Hashimoto
0c38f40f0a macos: secure input manager, global option in app 2024-09-19 10:11:31 -07:00
Mitchell Hashimoto
bcfe7d0f6c macos: update comment on why we don't start updater 2024-09-10 21:55:58 -07:00
Mitchell Hashimoto
359272a5f5 macos: start Sparkle after loading config 2024-09-10 21:54:40 -07:00
hanna
fd9d38481b refactor: attempted autoupdate configuration 2024-09-10 21:40:17 -07:00
Mitchell Hashimoto
90d21a6a65 macos: do not open a window on reopen if terminal manager has any
Fixes #2135. See the comment on how this is possible.
2024-08-22 19:58:41 -07:00
pnodet
7ff9af1520 style(macos): cleanup trailing spaces 2024-08-21 21:53:09 +02:00
Jon Parise
2a66d37e48 Update functional URLs for ghostty-org 2024-06-01 16:44:09 -04:00
cryptocode
a304c953bf Rename menu item variable name accordingly 2024-05-10 12:08:19 +02:00
Mitchell Hashimoto
dd0ec492e4 macos: wrap syncAppearance in async call
Fixes #1656

When called as part of window restoration AppKit has a lock, so
NSAppearance changes need to be called async.

See deadlock:

```
Thread 1 Queue : com.apple.main-thread (serial)
0	0x000000018fd63fac in __ulock_wait ()
1	0x00000001069bf720 in _dlock_wait ()
2	0x00000001069bfaec in _dispatch_group_wait_slow ()
3	0x0000000106b5f5c4 in interposed_dispatch_group_wait ()
4	0x00000001937fb1f0 in NSCGSTransactionRunPreCommitActions_ ()
5	0x00000001938f1230 in -[_NSCGSTransaction synchronize] ()
6	0x00000001938f11ac in NSCGSTransactionSynchronize ()
7	0x000000019382ad30 in +[NSCGSWindow(NSCGSSpace) isAnyWindowOnAVisibleSpace:] ()
8	0x000000019382a968 in -[NSWindow _isInSomeVisibleSpace] ()
9	0x000000019382a8e4 in -[NSWindow isOnActiveSpace] ()
10	0x0000000193db8d98 in -[NSApplication(NSApplicationAppearance_Internal) _invalidateWindowAppearances] ()
11	0x00000001938f44d4 in -[NSApplication(NSAppearanceCustomization) setAppearance:] ()
12	0x0000000102c48050 in AppDelegate.syncAppearance() at /Users/mitchellh/code/go/src/github.com/mitchellh/ghostty/macos/Sources/App/macOS/AppDelegate.swift:412
13	0x0000000102c47840 in AppDelegate.configDidReload(_:) at /Users/mitchellh/code/go/src/github.com/mitchellh/ghostty/macos/Sources/App/macOS/AppDelegate.swift:380
14	0x0000000102c43c7c in AppDelegate.applicationDidFinishLaunching(_:) at /Users/mitchellh/code/go/src/github.com/mitchellh/ghostty/macos/Sources/App/macOS/AppDelegate.swift:110
```
2024-04-05 10:01:44 -07:00
Mitchell Hashimoto
e5400bad06 config: add window-theme = auto for automatic choosing based on bg color 2024-02-01 20:49:28 -08:00
Mitchell Hashimoto
a41ee3cabe macos: make global macOS fullscreen keybind work
Fixes #1389

This is just a fun AppKit quirk. This menu item is set automatically
based on the keyboard shortcut (apparently) and when its overwritten
then its gone forever. So, let's just not set it.
2024-01-27 09:58:02 -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
8b11d20cb0 macos: register a services menu 2024-01-21 16:39:52 -08:00
Qwerasd
51f53aa9bf Added macOS file open handler 2024-01-16 16:26:21 -05:00
Mitchell Hashimoto
875a774d4b macos: remove AppState and unify onto Ghostty.App cross-platform 2024-01-14 19:35:57 -08:00
Mitchell Hashimoto
eba3d5414d macos: Ghostty.Config to store all config-related operations 2024-01-14 15:53:33 -08:00
Mitchell Hashimoto
48af1c6c99 macos: add iOS target 2024-01-13 22:24:35 -08:00