import AppKit @MainActor public enum VoiceOverStatus { public static var isRunning: Bool { !runningProcessIDs.isEmpty } package static var runningProcessIDs: Set { Set( NSRunningApplication.runningApplications(withBundleIdentifier: "com.apple.VoiceOver") .filter { isRunning(bundleIdentifier: $0.bundleIdentifier, terminated: $0.isTerminated) } .map(\.processIdentifier)) } static func isRunning(bundleIdentifier: String?, terminated: Bool) -> Bool { // The workspace preference can stay enabled after the screen reader exits. bundleIdentifier == "com.apple.VoiceOver" && !terminated } public static func observeChanges(_ onChange: @escaping @MainActor () -> Void) -> VoiceOverObservation { VoiceOverObservation(center: NSWorkspace.shared.notificationCenter, onChange: onChange) } }