             startedAtLogin = true
             killLauncher()
         }
-        
-        let appleEventManager = NSAppleEventManager.shared()
-        appleEventManager.setEventHandler(self, andSelector: #selector(handleGetURLEvent), forEventClass: UInt32(kInternetEventClass), andEventID: UInt32(kAEGetURL))
 
         statusItem = NSStatusBar.system().statusItem(withLength: NSSquareStatusItemLength)
 


    let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Default")

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        os_log("applicationDidFinishLaunching: %{public}@", log: log, type: .default, blockstackDataURL().absoluteString)


    }
    
    func handleGetURLEvent(_ event: NSAppleEventDescriptor, replyEvent: NSAppleEventDescriptor) {

        var senderAppUrl : URL? = nil
        let senderAppName = event.attributeDescriptor(forKeyword: keyAddressAttr)?.stringValue
        // This `keyOriginalAddressAttr` seems to always match `keyAddressAttr`..
        // Leaving this here for later debugging if needed.
        // let senderAppName = event.attributeDescriptor(forKeyword: keyOriginalAddressAttr)?.stringValue
        
        if senderAppName != nil {
            if let senderAppPath = NSWorkspace.shared().fullPath(forApplication: senderAppName!) {
                senderAppUrl = URL.init(fileURLWithPath: senderAppPath)
                os_log("Blockstack Auth Request came from app: %{public}@", log: log, type: .info, senderAppPath)
            } else {
                os_log("Blockstack Auth Request sender not mapped to an app: %{public}@", log: log, type: .info, senderAppName!)
            }
        } else {
            os_log("Blockstack Auth Request sender not mapped to an app: %{public}@", log: log, type: .info, "keyAddressAttr not provided")
        }
        
        let url = (event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue) ?? ""
        let authRequest = url.replacingOccurrences(of: "blockstack:", with: "")
        os_log("Blockstack URL: %{public}@", log: log, type: .info, url)
        os_log("Blockstack Auth Request: %{public}@", log: log, type: .debug, authRequest)

        openPortal(path: "\(portalAuthenticationPath)\(authRequest)", openWithApplication: senderAppUrl)

    }

