项目作者: jesse-c

项目描述 :
Automatically set the volume of macOS to a specified volume.
高级语言: Swift
项目地址: git://github.com/jesse-c/AutoVolume.git
创建时间: 2017-04-02T16:11:23Z
项目社区:https://github.com/jesse-c/AutoVolume

开源协议:MIT License

下载


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.

Alternative:

Use HammerSpoon and hook into systemDidWake and mute default audio device. For example:

  1. function sleepWatch(eventType)
  2. if (eventType == hs.caffeinate.watcher.systemWillSleep or eventType == hs.caffeinate.watcher.systemDidWake) then
  3. hs.audiodevice.defaultOutputDevice():setVolume(0)
  4. end
  5. end
  6. sleepWatcher = hs.caffeinate.watcher.new(sleepWatch)
  7. sleepWatcher:start()

TODO

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

Wishlist

  • 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

Contributing

Contributions are welcome! See contributing.

License

See license.