         eventMonitor?.stop()
     }
 
-    @objc func togglePopover(_ sender: AnyObject?) {
-        popover.isShown ? closePopover(sender) : showPopover(sender)
-    }
-
-    @objc func terminate() { NSApp.terminate(self) }
-
     // MARK: CLLocationManagerDelegate
 
     func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate, CLLocationManagerDelegate {

    private let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
    private let locationManager = CLLocationManager()
    private let locationTimerInterval = TimeInterval(900)
    private var locationTimer: Timer?
    private var weatherTimer: Timer?
    private var currentLocation: CLLocationCoordinate2D?
    private var eventMonitor: EventMonitor?
    private let popover = NSPopover()

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        // Location

            repeats: true,
            block: { [weak self] _ in self?.getLocation() }
        )
    }

    @objc func togglePopover(_ sender: AnyObject?) {
        if popover.isShown {
            defaultsChanged = true
            closePopover(sender)
        } else {
            showPopover(sender)
        }
    }

    @objc func defaultsDidChange(_ sender: AnyObject?) {
        if defaultsChanged {
            defaultsChanged = false
            resetWeatherTimer()
        }
    }

    @objc func terminate() { NSApp.terminate(self) }

    private func resetWeatherTimer() {
        weatherTimer?.invalidate()
        weatherTimer = Timer.scheduledTimer(
            timeInterval: DefaultsManager.shared.refreshInterval,
            target: self,
            selector: #selector(getWeather),
            userInfo: nil, repeats: true
        )
        weatherTimer?.fire()
    }

    private func getWeatherViaZipCode() {
