mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

paswitch (397B)


      1 #!/bin/bash
      2 
      3 # search for a sink called "$1", set it as default and move everything to it
      4 
      5 RES=$(pals "$1" | awk '{print $1}')
      6 NRES=$(echo "$RES" | wc -l)
      7 if [ $NRES -lt 1 ]
      8 then
      9   echo "no such sink found, here are the sinks:"
     10   pals
     11   exit 1
     12 fi
     13 if [ $NRES -gt 1 ]
     14 then
     15   echo "multiple sinks found, be more precise:"
     16   pals "$1"
     17   exit 1
     18 fi
     19 
     20 palsi | pamsi "$RES"
     21 
     22 pacmd set-default-sink "$RES"
     23