macos: set the app icon in syncAppearance to delay the icon update

Fixes #8734

This forces the app icon to be set on another event loop tick from
the main startup. 

In the future, we should load and set the icon completely in another
thread. It appears that all the logic we have is totally thread-safe.
This commit is contained in:
Mitchell Hashimoto
2025-09-19 12:07:23 -07:00
parent 55153937c6
commit f60bdb0faa

View File

@@ -860,7 +860,12 @@ class AppDelegate: NSObject,
} else { } else {
GlobalEventTap.shared.disable() GlobalEventTap.shared.disable()
} }
}
/// Sync the appearance of our app with the theme specified in the config.
private func syncAppearance(config: Ghostty.Config) {
NSApplication.shared.appearance = .init(ghosttyConfig: config)
switch (config.macosIcon) { switch (config.macosIcon) {
case .official: case .official:
self.appIcon = nil self.appIcon = nil
@@ -909,11 +914,6 @@ class AppDelegate: NSObject,
} }
} }
/// Sync the appearance of our app with the theme specified in the config.
private func syncAppearance(config: Ghostty.Config) {
NSApplication.shared.appearance = .init(ghosttyConfig: config)
}
//MARK: - Restorable State //MARK: - Restorable State
/// We support NSSecureCoding for restorable state. Required as of macOS Sonoma (14) but a good idea anyways. /// We support NSSecureCoding for restorable state. Required as of macOS Sonoma (14) but a good idea anyways.