Skip to content

Instantly share code, notes, and snippets.

@Aupajo
Created November 7, 2017 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aupajo/e7bc570d318b08a59f211024b278d406 to your computer and use it in GitHub Desktop.
Save Aupajo/e7bc570d318b08a59f211024b278d406 to your computer and use it in GitHub Desktop.
#!/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}"
end
exec "osascript -e #{command.inspect}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment