// // AppDelegate.swift // Menubar RunCat // // Created by Takuto Nakamura on 2019/08/06. // Copyright © 2019 Takuto Nakamura. All rights reserved. // import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { @IBOutlet weak var menu: NSMenu! private let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) private let nc = NSWorkspace.shared.notificationCenter private var anim = [(Double, [NSImage])]() private var cnt: Int = 0 private var isRunning: Bool = false private var interval: Double = 1.0 private let cpu = CPU() private var cpuTimer: Timer? = nil private var usage: (value: Double, description: String) = (0.0, "") private var isShowUsage: Bool = false private var animId: Int = 0 func applicationDidFinishLaunching(_ aNotification: Notification) { for (name, len, rate) in [ ("cat_page", 5, 1.0), ("dino", 2, 1.0), ("ablobcatbongo", 2, 0.5), ("ablobcatcoffee", 24, 0.2), ("ablobcatrave", 18, 0.2), ("ablobcatwave", 24, 0.4), ("ablobattention", 22, 0.2), ("ablobblewobble", 15, 0.2), ("annoyingdog", 2, 1.0), ] { let animFrames = (0..