diff options
author | Roopesh Chander <roop@roopc.net> | 2019-03-29 00:02:54 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-03-29 00:17:37 +0530 |
commit | dd9506eceeae1144078aa33cd55bf5bff8aa7dc7 (patch) | |
tree | 199567bdd78b7396a7dec5425a5a7d367ab2561c | |
parent | wireguard-go-bridge: update deps (diff) | |
download | wireguard-apple-dd9506eceeae1144078aa33cd55bf5bff8aa7dc7.tar.xz wireguard-apple-dd9506eceeae1144078aa33cd55bf5bff8aa7dc7.zip |
macOS: If a sheet is being shown, ignore quit and bring window to front
Otherwise, the 'exiting with an active tunnel' alert could get queued up
to be shown after the current sheet is dismissed.
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index 1d6d294..990a379 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -44,6 +44,11 @@ class AppDelegate: NSObject, NSApplicationDelegate { } @objc func quit() { + if let manageWindow = manageTunnelsWindowObject, manageWindow.attachedSheet != nil { + NSApp.activate(ignoringOtherApps: true) + manageWindow.orderFront(self) + return + } registerLoginItem(shouldLaunchAtLogin: false) guard let currentTunnel = tunnelsTracker?.currentTunnel, currentTunnel.status == .active || currentTunnel.status == .activating else { NSApp.terminate(nil) |