forked from domzilla/Caffeine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppDelegate.swift
More file actions
40 lines (34 loc) · 1.12 KB
/
Copy pathAppDelegate.swift
File metadata and controls
40 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// AppDelegate.swift
// Caffeine
//
// Created by Dominic Rodemer on 11.11.25.
//
import SwiftUI
import Cocoa
import Sparkle
class AppDelegate: NSObject, NSApplicationDelegate, SPUStandardUserDriverDelegate {
// Make this lazy so `self` can be used safely
private lazy var updaterController = SPUStandardUpdaterController(
startingUpdater: true,
updaterDelegate: nil,
userDriverDelegate: self
)
private var statusItem: NSStatusItem?
private var menuBarController: MenuBarController?
func applicationDidFinishLaunching(_ notification: Notification) {
// Create the menu bar controller
menuBarController = MenuBarController(updaterController: updaterController)
// Hide the dock icon - this is a menu bar only app
NSApp.setActivationPolicy(.accessory)
}
func applicationWillTerminate(_ notification: Notification) {
// Clean up
menuBarController?.cleanup()
}
// MARK: SPUStandardUserDriverDelegate
// MARK: ---
func supportsGentleScheduledUpdateReminders() -> Bool {
return true
}
}