diff options
author | Roopesh Chander <roop@roopc.net> | 2019-03-29 00:10:05 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-03-29 00:17:37 +0530 |
commit | a74dd24578ea76d12543298662d400404a2048ce (patch) | |
tree | 0aef6855694eb7809fc3aeb6df8ccc0c9f12e60f | |
parent | macOS: If a sheet is being shown, ignore quit and bring window to front (diff) | |
download | wireguard-apple-a74dd24578ea76d12543298662d400404a2048ce.tar.xz wireguard-apple-a74dd24578ea76d12543298662d400404a2048ce.zip |
macOS: Bring app to front before 'exiting with an active tunnel' alert
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 6 |
1 files 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 { |