0

When I connect the headphones, I have to change the output port from the audio mixer, and do the reverse process by disconnecting them.

Could you help me, to make this happen automatically when you connect or disconnect the headphones, or make a shortcut so that it changes without having to do the whole process?

PD: I am using Ubuntu Studio 20.04 (focal fossa) with XFCE desktop environment

1 Answers1

0

Have the same problem... After reading many forums i dont find proper hint and write own solution this is my first script and I don’t know how good it is, but it does its job

sudo journalctl -u acpid -f | grep -oP --line-buffered 'completed input layer event "jack/headphone HEADPHONE \K[^ ]*' | while read -r line 
do case "$line" in
    unplug\"        ) pactl set-sink-port 1 analog-output-speaker;;
    plug\"          ) pactl set-sink-port 1 analog-output-headphones ;;
esac;
done