Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
1,100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.53 KB | None | 0 0
  1. #!/bin/ruby
  2.  
  3. # Get the current default sink
  4. default_sink_index = `pacmd list-sinks | grep "\* index:"`.match(/\d/)[0]
  5.  
  6. # Set the sink to use
  7. new_sink_index = nil
  8. if default_sink_index == '0'
  9.   new_sink_index = '1'
  10. elsif default_sink_index == '1'
  11.   new_sink_index = '0'
  12. end
  13.  
  14. STDOUT.puts "Going to sink: #{new_sink_index}"
  15.  
  16. # Use the shellscript to make the change for us
  17. # From http://askubuntu.com/questions/71863/how-to-change-pulseaudio-sink-with-pacmd-set-default-sink-during-playback
  18. `movesinks.sh #{new_sink_index}`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement