             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)
 

        openPortal(path: "/account")
    }
    
    func openPortal(path: String) {
        let portalURLString = "\(portalBaseUrl())\(path)"
        os_log("Opening portal with String: %{public}@", log: log, type: .info, portalURLString)
        let portalURLWithSecretString = "\(portalURLString)#coreAPIPassword=\(createOrRetrieveCoreWalletPassword())"
        let portalURLWithSecretAndLogPortString = "\(portalURLWithSecretString)&logServerPort=\(logServerPort)"
        let portalURLWithSecretLogPortAndRegtest = "\(portalURLWithSecretAndLogPortString)&regtest=\(isRegTestModeEnabled ? 1 : 0)"
        let portalURL = URL(string: portalURLWithSecretLogPortAndRegtest)
        NSWorkspace.shared().open(portalURL!)
    }

    func statusItemClick(sender: AnyObject?) {


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

    func applicationWillFinishLaunching(_ notification: Notification) {
        // This must be registered before `applicationDidFinishLaunching` otherwise the event
        // may not be triggered if Blockstack.app was not already running.
        let appleEventManager = NSAppleEventManager.shared()
        appleEventManager.setEventHandler(self, andSelector: #selector(handleGetURLEvent), forEventClass: UInt32(kInternetEventClass), andEventID: UInt32(kAEGetURL))
    }
    
    func applicationDidFinishLaunching(_ aNotification: Notification) {
        os_log("applicationDidFinishLaunching: %{public}@", log: log, type: .default, blockstackDataURL().absoluteString)

