Skip to content

Instantly share code, notes, and snippets.

@Aupajo Aupajo/vol
Created Nov 7, 2017

What would you like to do?
#!/usr/bin/env ruby
# Examples:
# vol Print the current sound volume
# vol 30 Set the volume to 30%
# vol mute
# vol unmute
command = case ARGV.first
when 'mute' then "set volume output muted true"
when 'unmute' then "set volume output muted false"
when nil then "output volume of (get volume settings)"
else "set volume output volume #{ARGV.first.to_i}"
exec "osascript -e #{command.inspect}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.