From ffd181f10dea8901f7d6f43f5a3559942f2e0209 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 11 Sep 2023 13:59:03 -0700 Subject: [PATCH] macos: don't steal focus for config errors --- macos/Sources/AppDelegate.swift | 7 +++++-- .../Features/Settings/ConfigurationErrorsController.swift | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/macos/Sources/AppDelegate.swift b/macos/Sources/AppDelegate.swift index 3f81349bc..6785c3a30 100644 --- a/macos/Sources/AppDelegate.swift +++ b/macos/Sources/AppDelegate.swift @@ -188,8 +188,11 @@ class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, GhosttyApp // If we have configuration errors, we need to show them. let c = ConfigurationErrorsController.sharedInstance c.model.errors = state.configErrors() - Self.logger.warning("TEST did reload, count=\(c.model.errors.count)") - if (c.model.errors.count > 0) { c.showWindow(self) } + if (c.model.errors.count > 0) { + if (c.window == nil || !c.window!.isVisible) { + c.showWindow(self) + } + } } //MARK: - Dock Menu diff --git a/macos/Sources/Features/Settings/ConfigurationErrorsController.swift b/macos/Sources/Features/Settings/ConfigurationErrorsController.swift index 9e4b2a185..fc74a2aad 100644 --- a/macos/Sources/Features/Settings/ConfigurationErrorsController.swift +++ b/macos/Sources/Features/Settings/ConfigurationErrorsController.swift @@ -32,7 +32,6 @@ class ConfigurationErrorsController: NSWindowController, NSWindowDelegate { window.center() window.level = .popUpMenu window.contentView = NSHostingView(rootView: ConfigurationErrorsView(model: model)) - window.makeKeyAndOrderFront(self) } //MARK: - NSWindowDelegate