From: Roopesh Chander Date: Wed, 22 May 2019 09:48:50 +0000 (+0530) Subject: macOS: Ensure window is shown on app reopening X-Git-Tag: 0.0.20190531-9~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e582155a10f0c1cabec18aa887299fc159fe9695;p=thirdparty%2Fwireguard-apple.git macOS: Ensure window is shown on app reopening Signed-off-by: Roopesh Chander --- diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index 0860166..b53deb7 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -56,6 +56,14 @@ class AppDelegate: NSObject, NSApplicationDelegate { } } + func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows: Bool) -> Bool { + if hasVisibleWindows { + return true + } + showManageTunnelsWindow(completion: nil) + return false + } + @objc func quit() { if let manageWindow = manageTunnelsWindowObject, manageWindow.attachedSheet != nil { NSApp.activate(ignoringOtherApps: true)