diff options
author | Roopesh Chander <roop@roopc.net> | 2019-04-24 15:19:20 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-05-20 16:42:27 +0530 |
commit | 5e5481b69b554003f2cc8575da3bb4f9739145a7 (patch) | |
tree | 1c1aa5446c0f134d35b17b3c44207f195eea87f0 /WireGuard/WireGuard/UI/macOS | |
parent | macOS: Edit view: Save on Cmd+S (diff) | |
download | wireguard-apple-5e5481b69b554003f2cc8575da3bb4f9739145a7.tar.xz wireguard-apple-5e5481b69b554003f2cc8575da3bb4f9739145a7.zip |
macOS: Show app in dock when showing the manage tunnels window
This way, the app can participate in Cmd+Tab
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS')
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 5 | ||||
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/StatusMenu.swift | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index a5f8c34..3f69ea3 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -97,6 +97,11 @@ class AppDelegate: NSObject, NSApplicationDelegate { } return .terminateCancel } + + func applicationShouldTerminateAfterLastWindowClosed(_ application: NSApplication) -> Bool { + application.setActivationPolicy(.accessory) + return false + } } extension AppDelegate: StatusMenuWindowDelegate { diff --git a/WireGuard/WireGuard/UI/macOS/StatusMenu.swift b/WireGuard/WireGuard/UI/macOS/StatusMenu.swift index 5cf04d3..150c55e 100644 --- a/WireGuard/WireGuard/UI/macOS/StatusMenu.swift +++ b/WireGuard/WireGuard/UI/macOS/StatusMenu.swift @@ -151,12 +151,14 @@ class StatusMenu: NSMenu { } @objc func manageTunnelsClicked() { + NSApp.setActivationPolicy(.regular) NSApp.activate(ignoringOtherApps: true) guard let manageTunnelsWindow = windowDelegate?.manageTunnelsWindow() else { return } manageTunnelsWindow.makeKeyAndOrderFront(self) } @objc func importTunnelsClicked() { + NSApp.setActivationPolicy(.regular) NSApp.activate(ignoringOtherApps: true) guard let manageTunnelsWindow = windowDelegate?.manageTunnelsWindow() else { return } manageTunnelsWindow.makeKeyAndOrderFront(self) |