 
 }
 
+extension AppDelegate: NSApplicationDelegate {
+    // MARK: Lifecycle
+
+    func applicationDidFinishLaunching(_ aNotification: Notification) {
+        configureStatusItem()
+
+        // NOTE: Set the timer for regularly check.
+        timer = Timer(fireAt: Date(), interval: PATROL_INTERVAL_SEC, target: self, selector: #selector(AppDelegate.patrol(_:)), userInfo: false, repeats: true)
+        RunLoop.current.add(timer, forMode: RunLoopMode.defaultRunLoopMode)
+    }
+
+    func applicationWillTerminate(_ aNotification: Notification) {
+    }
+}
+
 extension AppDelegate: NSMenuDelegate {
     func menuWillOpen(_ menu: NSMenu) {
         // MEMO: If user defaults cleanup, will the menu change.

//  Copyright © 2016年 taketin. All rights reserved.
//

import AppKit

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

    enum IconState {
        case normal, warning

    override init() {
        loginViewController = LoginViewController(nibName: "LoginViewController", bundle: nil)!
        popover.contentViewController = loginViewController
    }

    func configureStatusItem() {
