Last active
August 29, 2015 14:01
-
-
Save farfanoide/e5c8f4eec5218c1dc043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# Little script to select output source from cli. | |
# SwitchAudioSource must be in your PATH | |
# https://code.google.com/p/switchaudio-osx/ | |
if ARGV.empty? | |
sources = `SwitchAudioSource -a | grep -i output`.split "\n" | |
sources.each_with_index { |source, index| puts "#{index}) #{source}" } | |
option = gets | |
audio = sources[option.to_i].sub(' (output)','') | |
else | |
option = ARGV[0] | |
case option | |
when '1' | |
audio = 'Built-in Output' | |
when '2' | |
audio = 'Saffire 6USB2.0' | |
when '3' | |
audio = 'HDMI' | |
else | |
puts 'opcion invalida' | |
audio = 'nada che' | |
end | |
end | |
`SwitchAudioSource -t output -s "#{audio}"` unless audio == 'nada che' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment