macOS: Ensure window is shown on app reopening

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2019-05-22 15:18:50 +05:30
parent 70d19691a7
commit e582155a10
1 changed files with 8 additions and 0 deletions

View File

@ -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() { @objc func quit() {
if let manageWindow = manageTunnelsWindowObject, manageWindow.attachedSheet != nil { if let manageWindow = manageTunnelsWindowObject, manageWindow.attachedSheet != nil {
NSApp.activate(ignoringOtherApps: true) NSApp.activate(ignoringOtherApps: true)