From e582155a10f0c1cabec18aa887299fc159fe9695 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 22 May 2019 15:18:50 +0530 Subject: macOS: Ensure window is shown on app reopening Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- cgit v1.2.3-59-g8ed1b