Skip to content
Automatically set the volume of macOS to a specified volume.
Swift CSS HTML Objective-C
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
AutoVolume.xcodeproj Rename from Agent -> AutoVolume. Jan 8, 2017
AutoVolume Set window as initial controller. Change presentation to single. Jul 5, 2017
AutoVolumeHelper Rename from Agent -> AutoVolume. Jan 8, 2017
AutoVolumeHelperTests Rename from Agent -> AutoVolume. Jan 8, 2017
AutoVolumeTests Remove old agent references. Jul 5, 2017
AutoVolumeUITests Rename from Agent -> AutoVolume. Jan 8, 2017
website Add download link. Apr 2, 2017
.gitignore Initial commit with volume module. Dec 17, 2016 Add license and contributing. Apr 2, 2017
LICENSE Correct license. Sep 24, 2017 Add Hammerspoon example. Oct 31, 2017

AutoVolume (macOS)

Home page

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.


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

sleepWatcher =


  • Add user notifications
  • Remove NSLog or hide behind debug flag


  • Choose audio device
  • Choose event for when to act
  • Only change volume if a specified amount of time has elapsed
  • Add option to display the current volume in a notable way on event
  • Act only if volume is above a specified threshold
  • Set time when to set volume (suggested by Simone M)
  • [Optional] menu bar icon
  • Set volume on system login


Contributions are welcome! See contributing.


See license.

You can’t perform that action at this time.