SHARE
TWEET

Untitled

a guest Jul 1st, 2015 628 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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}`
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top