There isn’t a current solution to this challenge, so here’s my 2 cents.
In the AppDelegate.swift:
func applicationDidFinishLaunching(aNotification: NSNotification) {
addWindowController()
addResignActiveNotification()
}
func applicationWillTerminate(aNotification: NSNotification) {
let notificationCenter = NSNotificationCenter.defaultCenter()
notificationCenter.removeObserver(self)
}
func addResignActiveNotification() {
let notificationCenter = NSNotificationCenter.defaultCenter()
notificationCenter.addObserver(
self,
selector: #selector(applicationInactive),
name: NSApplicationDidResignActiveNotification,
object: nil)
}
func applicationInactive(notification: NSNotification) {
NSBeep()
}