[download]

local/bin/audio

   1 #!/bin/bash
   2 
   3 inline(){ # {{{
   4     paste - - | sed '
   5         s/"//g
   6         s/\s\+index: /\t/
   7         s/\s\+[a-z.]* = /\t/
   8     '
   9 } # }}}
  10 
  11 [[ ! $1 ]] && pacmd list-sinks |
  12 grep 'index\|device\.description' |
  13 inline && exit
  14 
  15 pactl set-default-sink $1 || exit
  16 $0 | awk -F \\t '/*/ { print $NF }'
  17 
  18 pacmd list-sink-inputs |
  19 grep 'index\|application\.name' |
  20 inline | while read id app; do
  21     echo "[$id] $app"
  22     pacmd move-sink-input $id $1
  23 done