Automatically set the volume of macOS to a specified volume.
MIT License
AutoVolume automatically sets the volume of macOS to a specified volume. At the moment it only fires on sleep. For example, the primary use case is to set the system volume to 0 when waking from sleep to save being surprised if you were listening to music quite loud before you closed it and fell asleep.
Why? To learn about macOS development, begin the 'Agent' idea, and practice design.
Alternative:
Use HammerSpoon and hook into systemDidWake and mute default audio device. For example:
function sleepWatch(eventType)
if (eventType == hs.caffeinate.watcher.systemWillSleep or eventType == hs.caffeinate.watcher.systemDidWake) then
hs.audiodevice.defaultOutputDevice():setVolume(0)
end
end
sleepWatcher = hs.caffeinate.watcher.new(sleepWatch)
sleepWatcher:start()
Contributions are welcome! See contributing.
See license.