Initial MultiTimer macOS app
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import AppKit
|
||||
import AudioToolbox
|
||||
|
||||
final class AlarmManager {
|
||||
static let shared = AlarmManager()
|
||||
|
||||
private var sound: NSSound?
|
||||
|
||||
private init() {}
|
||||
|
||||
func playAlarm() {
|
||||
AudioServicesPlaySystemSound(1005)
|
||||
|
||||
if let url = URL(string: "file:///System/Library/Sounds/Glass.aiff") {
|
||||
sound = NSSound(contentsOf: url, byReference: true)
|
||||
sound?.volume = 1.0
|
||||
sound?.play()
|
||||
}
|
||||
|
||||
NSApp.requestUserAttention(.criticalRequest)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user