*nohtml*

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 pacmd set-default-sink $1
  16 pacmd list-sink-inputs |
  17 grep 'index\|application\.name' |
  18 inline | while read id app; do
  19     echo "[$id] $app";
  20     pacmd move-sink-input $id $1
  21 done
  22 
  23 volume +0
  24 pkill -USR1 polybar