From: Roopesh Chander Date: Tue, 8 Jan 2019 21:34:41 +0000 (+0530) Subject: macOS: Get the app back in focus after macOS' VPN prompt X-Git-Tag: 0.0.20190207-1~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc8ea55023d547cf59f6417d2d8b35e61f31fdc8;p=thirdparty%2Fwireguard-apple.git macOS: Get the app back in focus after macOS' VPN prompt Signed-off-by: Roopesh Chander --- 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) {