mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-25 00:21:46 +00:00
macos: do not load the config errors window when there are no errors
Measured on macOS (Apple Silicon) during app launch, via a startup timeline instrumented across the Swift app and libghostty: config apply, errors step: 35.5ms -> 0.1ms main() -> first frame rendered: ~126ms -> ~93ms main() -> window visible: ~193ms -> ~173ms
This commit is contained in:
@@ -13,7 +13,15 @@ class ConfigurationErrorsController: NSWindowController, NSWindowDelegate, Confi
|
||||
@Published var errors: [String] = [] {
|
||||
didSet {
|
||||
if errors.count == 0 {
|
||||
self.window?.performClose(nil)
|
||||
// Only close the window if it was ever loaded: accessing
|
||||
// `window` on an NSWindowController loads the nib (and our
|
||||
// SwiftUI content view), which takes tens of milliseconds.
|
||||
// This happens on every app launch via the initial config
|
||||
// apply, when there are usually no errors and the window
|
||||
// was never loaded.
|
||||
if isWindowLoaded {
|
||||
self.window?.performClose(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user