aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/scripts/switch_audio.sh
blob: aff2543aaef148f4f42c1d5f21e607284f46954b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#/bin/sh

# Usage :
#   switch_audio.sh <sinkport_number>

headphones="analog-output-headphones"
lineout="analog-output-lineout"
sinkport="$1"

if [[ $(echo $(pacmd list | grep "active port") | cut -d" " -f3 | cut -d"<" -f2 | cut -d">" -f1) == $lineout ]]
then
   pacmd set-sink-port $sinkport $headphones
 elif [[ $(echo $(pacmd list | grep "active port") | cut -d" " -f3 | cut -d"<" -f2 | cut -d">" -f1) == $headphones ]]
 then
    pacmd set-sink-port $sinkport $lineout
  fi