Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active December 11, 2015 23:38
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 havenwood/4677566 to your computer and use it in GitHub Desktop.
Save havenwood/4677566 to your computer and use it in GitHub Desktop.
require "./alfred"
results = Alfred::Feedback.new
available_outputs = `./SwitchAudioSource -a | grep "(output)" | sed 's/ (output)$//'`
current_output = `./SwitchAudioSource -c`
def ditch_line available, current
available.split("\n").delete_if { |line| line == current }.join("\n")
end
result = {}
result[:title] = result[:uid] = ditch_line available_outputs, current_output
result[:subtitle] = current_output
result[:arg] = ""
results << result
puts results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment