From f60bdb0faa964d06201a0215c254a2d5de91bae3 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 19 Sep 2025 12:07:23 -0700 Subject: [PATCH] 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. --- macos/Sources/App/macOS/AppDelegate.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macos/Sources/App/macOS/AppDelegate.swift b/macos/Sources/App/macOS/AppDelegate.swift index df3a1f4f4..942aecdd4 100644 --- a/macos/Sources/App/macOS/AppDelegate.swift +++ b/macos/Sources/App/macOS/AppDelegate.swift @@ -860,7 +860,12 @@ class AppDelegate: NSObject, } else { 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) { case .official: 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 /// We support NSSecureCoding for restorable state. Required as of macOS Sonoma (14) but a good idea anyways.