Normally, after a recent fresh install of Linux Mint 19.3 x64 MATE on an Acer Aspire E15 laptop, media keys (using Fn+arrow keys on the built-in keyboard, or dedicated keys on an external keyboard) work fine for changing the volume: A modal pops up showing the current volume level, and disappears after a moment of not adjusting the volume. Also, the default volume control tray icon affects the same volume level when I drag the slider.

Now, sometimes we'll plug in an HDMI device that has built-in speakers, and want the audio to go through the speakers. Often the software audio source (browser, for example) is already open, and the only way I've found to switch its output to HDMI without having to restart the browser, is to go into the default Sounds applet:

Sound Preferences applet showing analog stereo duplex enabled, with HDMI selected and disabled

...and set the analog output to Off, and the HDMI output to HDMI.

The problem is, once I've done this (or the other way around—started with HDMI and then switched back to analog stereo) the media keys no longer have an effect on the volume level. (But they do still make a popup showing a level changing...it just doesn't actually affect what's heard!)

Also, the volume control tray applet no longer has an effect on what's heard. The slider still visually works, but strangely, seems to have become independent from the popup that the media keys produce. Then, often the tray applet will simply disappear entirely (crashed, I guess.)

At that point the only (GUI-based) way to change the volume is to open the Sounds applet pictured above and adjust it from the slider there.

My main question is, how can I keep them working after switching audio outputs as described?

Or, if there happens to be a way to avoid this problem by using a different method than described for forcing an audio output change, that would be a welcome answer too.

2 Answers 2


The following isn't ideal, since it gets rid of the nice on-screen display that shows the current volume, but it does at least work reliably even after the tray applet disappears and the various volume controls seem to be disconnected from one another.

Create a script somewhere with the following:

CURVOL=`pacmd list-sinks | grep 'volume: [^0-9]' | sed 's/.* \([0-9]\{1,3\}\)\%.*/\1/'`
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
VOLCHANGE=`cat $DIR/volume-increment`
if (($CURVOL > (100 - $VOLCHANGE))) ; then
  pactl set-sink-volume @DEFAULT_SINK@ 100% ;
  pactl set-sink-volume @DEFAULT_SINK@ +$VOLCHANGE% ;

In the same directory, create a file called volume-increment that has the absolute percentage volume you'd like to change by each time this is activated. E.g. you might have a file that consists of one line with the character 5 in it.

A similar script can be used for lowering the volume:

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
VOLCHANGE=`cat $DIR/volume-increment`
pactl set-sink-volume @DEFAULT_SINK@ -$VOLCHANGE% ;

Then open the Keyboard Shortcuts applet, disable the original volume control ones, and add custom ones pointing to the above scripts.

The reason the "volume up" one is a bit longer is to cap it at 100%. Without this, you'll be able to set the volume way too high (higher than the 140% cap of the Sound applet) and could maybe break your hardware (or at least your hearing.)

(This could be refactored, too, but it works well enough.)


Same problem when set headphones or bluetooth headset. Try restart sound:

pulseaudio --kill

pulseaudio -D

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .