mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-29 14:38:35 +00:00
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.
This commit is contained in:
@@ -207,8 +207,8 @@ extension Ghostty {
|
||||
|
||||
extension Notification.Name {
|
||||
/// Configuration change. If the object is nil then it is app-wide. Otherwise its surface-specific.
|
||||
static let ghosttyConfigChange = Notification.Name("com.mitchellh.ghostty.configChange")
|
||||
static let GhosttyConfigChangeKey = ghosttyConfigChange.rawValue
|
||||
static let ghosttyConfigDidChange = Notification.Name("com.mitchellh.ghostty.configDidChange")
|
||||
static let GhosttyConfigChangeKey = ghosttyConfigDidChange.rawValue
|
||||
|
||||
/// Goto tab. Has tab index in the userinfo.
|
||||
static let ghosttyMoveTab = Notification.Name("com.mitchellh.ghostty.moveTab")
|
||||
@@ -221,9 +221,6 @@ extension Ghostty.Notification {
|
||||
/// Used to pass a configuration along when creating a new tab/window/split.
|
||||
static let NewSurfaceConfigKey = "com.mitchellh.ghostty.newSurfaceConfig"
|
||||
|
||||
/// Posted when the application configuration is reloaded.
|
||||
static let ghosttyDidReloadConfig = Notification.Name("com.mitchellh.ghostty.didReloadConfig")
|
||||
|
||||
/// Posted when a new split is requested. The sending object will be the surface that had focus. The
|
||||
/// userdata has one key "direction" with the direction to split to.
|
||||
static let ghosttyNewSplit = Notification.Name("com.mitchellh.ghostty.newSplit")
|
||||
|
Reference in New Issue
Block a user