]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
macOS: Show app in dock when showing the manage tunnels window
authorRoopesh Chander <roop@roopc.net>
Wed, 24 Apr 2019 09:49:20 +0000 (15:19 +0530)
committerRoopesh Chander <roop@roopc.net>
Mon, 20 May 2019 11:12:27 +0000 (16:42 +0530)
This way, the app can participate in Cmd+Tab

Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/WireGuard/UI/macOS/AppDelegate.swift
WireGuard/WireGuard/UI/macOS/StatusMenu.swift

index a5f8c34d4add1b0e5ac3d8fa88e9599589ba9efe..3f69ea3b7160d31c776469bf9cc07592a77f6a10 100644 (file)
@@ -97,6 +97,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
         }
         return .terminateCancel
     }
+
+    func applicationShouldTerminateAfterLastWindowClosed(_ application: NSApplication) -> Bool {
+        application.setActivationPolicy(.accessory)
+        return false
+    }
 }
 
 extension AppDelegate: StatusMenuWindowDelegate {
index 5cf04d3c03be09c5f6d8091771ad10d7a0f01636..150c55eb0108739bd3837fac73042217aad9e3da 100644 (file)
@@ -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)