From a74dd24578ea76d12543298662d400404a2048ce Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Fri, 29 Mar 2019 00:10:05 +0530 Subject: [PATCH] macOS: Bring app to front before 'exiting with an active tunnel' alert Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index 990a379..e80d971 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -57,8 +57,10 @@ class AppDelegate: NSObject, NSApplicationDelegate { let alert = NSAlert() alert.messageText = tr("macAppExitingWithActiveTunnelMessage") alert.informativeText = tr("macAppExitingWithActiveTunnelInfo") - if let window = manageTunnelsWindowObject { - alert.beginSheetModal(for: window) { _ in + NSApp.activate(ignoringOtherApps: true) + if let manageWindow = manageTunnelsWindowObject { + manageWindow.orderFront(self) + alert.beginSheetModal(for: manageWindow) { _ in NSApp.terminate(nil) } } else {