|
|
@@ -13,8 +13,13 @@ class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
|
|
|
|
|
var vc: ViewController? |
|
|
|
|
|
|
|
func applicationDidFinishLaunching(aNotification: NSNotification) { |
|
|
|
// Insert code here to initialize your application |
|
|
|
@IBOutlet weak var nightModeItem: NSMenuItem! |
|
|
|
|
|
|
|
func applicationDidFinishLaunching(_ aNotification: Notification) { |
|
|
|
nightModeItem.state = Int(UserDefaults.standard.string(forKey: "night_mode_state") ?? String(NSOffState))! |
|
|
|
if nightModeItem.state == NSOnState { |
|
|
|
vc?.toggle(isNight: true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func applicationWillTerminate(_ aNotification: Notification) { |
|
|
@@ -31,6 +36,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
|
let isOff = sender.state == NSOffState |
|
|
|
vc?.toggle(isNight: isOff) |
|
|
|
sender.state = isOff ? NSOnState : NSOffState |
|
|
|
UserDefaults.standard.set(String(sender.state), forKey: "night_mode_state") |
|
|
|
} |
|
|
|
|
|
|
|
@IBAction func saveDocument(_ sender: AnyObject) { |
|
|
|