57

My keyboard has dedicated keys to change the audio volume and to mute/unmute audio. How can I make these work in XFCE?

5 Answers 5

74
  1. Right click a panel -> Panel submenu -> Add New Items...
  2. Add an instance of PulseAudio Plugin
  3. Right click the icon that just appeared in your panel and click "Properties". Make sure "Enable keyboard shortcuts for volume control" is enabled.

You may have to install the PulseAudio Plugin first. In Debian and Debian-based distributions, the package is called xfce4-pulseaudio-plugin.

8
  • 3
    For future searchers: this solved my problem in a Thinkpad X1 when upgrading from Debian jessie to Debian stretch
    – bnewbold
    Aug 6, 2017 at 6:04
  • 2
    nice. Worked for my setup: Ubuntu 18 + xfce4 Aug 21, 2018 at 9:56
  • 2
    I dont want an item in my panel just for working hotkeys. Pretty strange solution
    – phil294
    Oct 14, 2018 at 0:36
  • 6
    @Blauhirn You can instead install xfce4-volumed-pulse (which appears to be packaged as xfce4-volumed in Ubuntu 18.04) to get hotkey support without a panel plugin. Launchpad
    – Jon
    Oct 26, 2018 at 8:26
  • 1
    This fixed the problem for me in Fedora 30.
    – Paul
    May 11, 2019 at 22:04
31

1.-Configuration

2.-Keyboard

3.-Application shortcuts

4.-Add

amixer -D pulse set Master 5%+     --> (Volume Up)
amixer -D pulse set Master 5%-     --> (Volume Down)
amixer -D pulse set Master toggle  --> (Mute/Unmute)

Update:

The parameter -D pulse was added to the command so it would work with current versions of xfce4 using pulseaudio for sound.

enter image description here

4
  • Adding the mute/unmute toggle only mutes the audio. When I press the same key combo, the audio is not unmuted. On Ubuntu 18.04 + xfce4. The volume up and down commands works well. Sep 11, 2018 at 14:55
  • I've used Enable keyboard shortcuts for volume control = Off, combined with amixer set Master 20%- command on Mute hotkey, to disable Mute hotkey and instead of Mute do a rapid volume reduce. Its more convenient than Mute :)
    – idonnie
    Feb 2, 2019 at 10:06
  • 1
    Ubuntu 18.04 / xfce4 I had to use amixer -D pulse set Master 15%- without the "-D pulse" the volume did not change. Jul 10, 2019 at 9:53
  • 1
    Use "amixer -D pulse set Master 1+ toggle" to make also unmute working
    – Panoptik
    Nov 19, 2019 at 9:25
20

Please notice, that both answers are correct, but each depend on different packages for the sound management. Erik here uses pulseaudio while Samuel Loza's answer implies, that alsamixer is used.

xfce4-pulseaudio-plugin

  1. Right click a panel -> Panel submenu -> Add New Items...
  2. Add an instance of PulseAudio Plugin
  3. Right click the icon that just appeared in your panel and click "Properties". Make sure "Enable keyboard shortcuts for volume control" is enabled. -> See: Sound settings -> Audio mixer will tell you what package you use. If pulseadio is used the field should tell pavucontrol.
  4. Open the configuration for your keyboard shortcuts and add the following commands:
    pactl -- set-sink-volume @DEFAULT_SINK@ +10% # raise volume by each 10% (more than 100% possible, might distort the sound)
    pactl set-sink-volume @DEFAULT_SINK@ -10% # reduce volume by each 10%
    pactl set-sink-mute @DEFAULT_SINK@ toggle # mute/unmutes audio

alsamixer (compare Samuel's answer)

  1. Check if alsamixer is working as your sound management.
  2. Go see the configuration for keyboard shortcuts and edit:
    amixer set Master 10%+ # raise volume by each 10 %
    amixer set Master 10%- # reduce volume by each 10 %
    amixer set Master toggle # mute/unmute audio

The first solution works for me on Debian stretch, I had problems with the sound after the upgrade from jessie. The settings work while using headphones as well. One can adapt the amount of increase/decrease in % freely.

Duplicated questions:
How to increase or decrease volume in Xfce with keyboard shortcuts? (English, NA)
Muting and unmuting sound with mutebutton (English, Debian jessie)

Further links:
https://wiki.debian.org/Sound (English, Debian)
https://bugs.launchpad.net/xfce4-volumed/+bug/883485 (English, Debian+Ubuntu)
https://askubuntu.com/questions/652890/shortcuts-volume-specific-output (English, Ubuntu 15.04)
Lower or increase pulseaudio volume on all outputs (English, Debian sid)
https://mysudo.wordpress.com/2015/03/27/unmute-pulseaudio-sound-in-xfce-debian-jessie/ (German, Debian jessie)
https://ubuntuforums.org/showthread.php?t=2342661 (English, Ubuntu)

2
  • 1
    Alsamixer should always work, even when using Pulseaudio
    – Nova
    Sep 27, 2018 at 13:10
  • 1
    pactl -- set-sink-volume @DEFAULT_SINK@ +10% with @DEFAULT_SINK@ instead of 0 as mentioned in the answer below helped me. I just add this as a comment so that other people find the remark immediately.
    – exchange
    Apr 28, 2020 at 11:40
3

Trying to use pactl -- set-sink-volume 0 +10% did not work for me.

Using @DEFAULT_SINK@ instead of 0 as the sink worked for me.

Example:

pactl -- set-sink-volume @DEFAULT_SINK@ +10%

1
2

Deleting the files in ~/.config/pulse then running the following in the terminal should fix it:

pulseaudio -k

You may need to restart your sound playing apps after that, and if pulseaudio doesn't restart on its own, this will restart it:

pulseaudio --start

Okay. At the bottom of the window click on Add. In the window that open for the command enter this:

amixer -D pulse sset Master 3%+ unmute

Now click on Ok, then it'll ask you to press the key(s) you want to assign to that command. Just press your volume up button and it should be done.

You can then repeat the process using this for the volume decrease button:

amixer -D pulse sset Master 3%- unmute

If you have a mute button as well, repeat one more time using this:

amixer -D pulse sset Master toggle

In case your permissions got messed up, this terminal command will fix them (I don't know any other way to do this, sorry!):

sudo chown -Rc $USER:$USER $HOME

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.