From d681e70ce59c5781c903f4da4cf4aa058d22e54e Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 9 Jan 2019 03:04:41 +0530 Subject: [PATCH] macOS: Get the app back in focus after macOS' VPN prompt --- .../macOS/ViewController/TunnelsListTableViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift index e6b72ca..130cf30 100644 --- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift @@ -234,6 +234,10 @@ extension TunnelsListTableViewController { if tunnelsManager.numberOfTunnels() == 1 { selectTunnel(at: 0) } + if !NSApp.isActive { + // macOS's VPN prompt might have caused us to lose focus + NSApp.activate(ignoringOtherApps: true) + } } func tunnelModified(at index: Int) {