Control Chrome audio from keyboard

I installed Ubuntu 22.04.1 on my iMac. I can control PC audio from the keyboard, but not Chrome audio. To raise or lower the audio of Chrome I have to go to settings->audio and adjust it from there: if I set the audio of Chrome to 25% and press the Audio + button on the keyboard to the maximum, the volume of Chrome always remains to 25%. I’d like to control Chrome’s audio through the keyboard, but I don’t know how. I search online, but I can’t find anything like this.
How can I solve it?

Asked By: fatopeo


I don’t know of any builtin shortcut, and there is separate volume control that will appear for each tab. But here is a custom solution with scripts:

  1. Paste the following into ~/.local/bin/chromevolumeup:
pactl list sink-inputs | tr \n \f | grep -Po 'Sink Input #Kd+(?=([^f]|ft)+Chrome)' | xargs -I_ pactl set-sink-input-volume _ +10%
  1. Paste the same thing into ~/.local/bin/chromevolumedown, except with +10% replaced with -10%

  2. Open both files’ properties and mark as executable

  3. Add a keyboard shortcut for each command

Answered By: Daniel T

Thanks for reply but don’t work, but you gave me a good idea so i solved in other way: i noticed that with the channel PCM of alsamixer i can adjust the volume of Chrome, so i went to Settings> Keyboard>View and customize shortcuts>Custom shortcuts and created the following shortcuts:

  • amixer set ‘PCM’ 5%+ > cmd+volume up key
  • amixer set ‘PCM’ 5%- > cmd+volume down key
    and it works!
    Thanks anyway.
Answered By: fatopeo
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.