pavucontrol shows Line-out as unplugged when Headphones are plugged in

13,376
  1. Open up alsamixer. Then press F6 to select your sound card, most likely ending with PCH.
  2. Scroll right till you find the Auto-Mute option.
  3. Press up or down arrow to disable it. Press Esc to quit alsamixer. alsamixer settings

Use the following script to automate it.

#!/bin/sh

NAME=$(basename -- "$0")

command -v amixer >/dev/null 2>&1 || { echo >&2 "amixer not installed"; exit 1; }
command -v pacmd >/dev/null 2>&1 || { echo >&2 "pacmd not installed"; exit 1; }

amixer -c1 sset "Auto-Mute Mode" Disabled > /dev/null

if [ -z $1 ]; then
  echo -e "Usage:\nFront Speakers\t: $NAME 0\t\nHeadphones\t: $NAME 1\nBoth Speakers\t: $NAME 2"
  exit 1
elif [ $1 -eq 0 ] 2> /dev/null; then
  pacmd set-sink-port 1 analog-output-lineout
  amixer -c1 set Headphone 0% > /dev/null
  amixer -c1 set Front 100% > /dev/null
elif [ $1 -eq 1 ] 2> /dev/null; then
  pacmd set-sink-port 1 analog-output-headphones
  amixer -c1 set Front 0% > /dev/null
  amixer -c1 set Headphone 100% > /dev/null
elif [ $1 -eq 2 ] 2> /dev/null; then
  pacmd set-sink-port 1 analog-output-headphones
  amixer -c1 set Front 100% > /dev/null
  amixer -c1 set Headphone 100% > /dev/null
else
  echo -e "Invalid argument"
  exit 1
fi

This assumes that the card you are using is numbered 1. Also, it assumes that your PulseAudio ports are named analog-output-lineout and analog-output-headphones. Save it as something like speakers.sh and chmod to set execute bit.

Run speakers.sh 1 for Headphones and speakers.sh 0 for Speakers.

Share:
13,376

Related videos on Youtube

BenjiWiebe
Author by

BenjiWiebe

My main job is cheese making. (Try some! It's really good!) I'm now a small engine mechanic. For hobbies, I write computer programs, fix other people's computers, and program AVR microcontrollers.

Updated on September 18, 2022

Comments

  • BenjiWiebe
    BenjiWiebe almost 2 years

    I have my speakers plugged in to the Line Out jack. When I plug my headphones into the front headphone jack, the speakers are muted and sound is played in my headphones, as expected. However, when I open up pavucontrol and manually select to send sound to Line Out (which is listed as unplugged) it mutes the headphones (as expected) but does NOT play audio out the speakers.

    I've tried many different permutations of pactl and pacmd, with set-sink-port and other commands, and every time, either nothing changes, or both the speakers and headphones are silent, as they are when I try to do it with pavucontrol.

    TL;DR; I want to be able to switch between headphones and speakers while both are plugged in, but the speakers are ALWAYS silent when my headphones are plugged in.

    I'm running up-to-date Fedora 23 with the KDE 5 desktop.

    • linuxdev2013
      linuxdev2013 over 8 years
      in alsamixer set auto-mute to enabled ---problem solved
    • BenjiWiebe
      BenjiWiebe over 8 years
      @linuxdev2013 I sure don't see any auto-mute option in alsamixer....
  • BenjiWiebe
    BenjiWiebe about 8 years
    Wait...it doesn't quite work. Now audio plays out both, when headphones are chosen. i.e. it always plays out of speakers regardless of whether Line Out or Headphones are selected.
  • Vishal Biswas
    Vishal Biswas about 8 years
    @BenjiWiebe You could always mute the speakers through alsamixer.
  • BenjiWiebe
    BenjiWiebe about 8 years
    Yes I could, but I don't want to have so many steps needed...I wish I could just quickly and easily toggle between two outputs!
  • Vishal Biswas
    Vishal Biswas about 8 years
    check main post for automation script
  • EGurelli
    EGurelli over 6 years
    Thank you for answer , it saves me from some headaches .