I have the following code in my app:
DistributedNotificationCenter.default.addObserver(self, selector: #selector(volumeChangeEvent(_:)), name: NSNotification.Name(rawValue: "com.apple.sound.settingsChangedNotification"), object: nil)
As expected volumeChangeEvent(_:) is called when I change or mute the volume output. But only if the Preferences app is open...
Any suggestion is welcome.
Alex