Fix Ghostty config reload theme refresh (#812) (#818)

This commit is contained in:
Austin Wang 2026-03-03 16:28:51 -08:00 committed by GitHub
parent 34c6250a37
commit a12fb563ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 0 deletions

View file

@ -660,6 +660,7 @@ class GhosttyApp {
private func loadDefaultConfigFilesWithLegacyFallback(_ config: ghostty_config_t) {
ghostty_config_load_default_files(config)
loadLegacyGhosttyConfigIfNeeded(config)
ghostty_config_load_recursive_files(config)
ghostty_config_finalize(config)
}
@ -767,6 +768,7 @@ class GhosttyApp {
ghostty_app_update_config(app, config)
lastAppearanceColorScheme = GhosttyConfig.currentColorSchemePreference()
NotificationCenter.default.post(name: .ghosttyConfigDidReload, object: nil)
scheduleSurfaceRefreshAfterConfigurationReload(source: source)
logThemeAction("reload end source=\(source) soft=\(soft) mode=soft")
return
}
@ -791,9 +793,16 @@ class GhosttyApp {
config = newConfig
lastAppearanceColorScheme = GhosttyConfig.currentColorSchemePreference()
NotificationCenter.default.post(name: .ghosttyConfigDidReload, object: nil)
scheduleSurfaceRefreshAfterConfigurationReload(source: source)
logThemeAction("reload end source=\(source) soft=\(soft) mode=full")
}
private func scheduleSurfaceRefreshAfterConfigurationReload(source: String) {
DispatchQueue.main.async {
AppDelegate.shared?.refreshTerminalSurfacesAfterGhosttyConfigReload(source: source)
}
}
func synchronizeThemeWithAppearance(_ appearance: NSAppearance?, source: String) {
let currentColorScheme = GhosttyConfig.currentColorSchemePreference(
appAppearance: appearance ?? NSApp?.effectiveAppearance