diff options
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift b/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift index c83a339..69ea731 100644 --- a/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift +++ b/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift @@ -9,7 +9,15 @@ class ErrorPresenter: ErrorPresenterProtocol { alert.messageText = title alert.informativeText = message onPresented?() - alert.runModal() - onDismissal?() + if let sourceVC = sourceVC as? NSViewController { + NSApp.activate(ignoringOtherApps: true) + sourceVC.view.window!.makeKeyAndOrderFront(nil) + alert.beginSheetModal(for: sourceVC.view.window!) { _ in + onDismissal?() + } + } else { + alert.runModal() + onDismissal?() + } } } |