46

I would like to be able to set three custom keyboard shortcuts to be able to decrease, increase and mute the volume in Ubuntu 12.04 (Unity). On my old Ubuntu 10.04 (Gnome) system I made CTRL + [, CTRL + ] and CTRL + \ my commands to achieve this.

What is the simplest way to go about this?

1

4 Answers 4

62

@dobey's solution works if you want to have only one keyboard shortcut for increasing / decreasing the volume.

If instead you want to have multiple key bindings controlling the volume (like to keep the default volume buttons on your laptop working, while adding additional keyboard shortcuts to use when you connect an external keyboard that does not have volume controls), then:

  1. Go to System Settings → Keyboard → Shortcuts → Custom Shortcuts.

  2. Click + to add a new keyboard shortcut. Set the "Name" to Volume up, "Command" to

    amixer -D pulse sset Master 5%+ and click Apply.

  3. Click Disabled next to your new key and choose the desired binding on your keyboard.

  4. Add another shortcut with name Volume down and command

    amixer -D pulse sset Master 5%-

Steps GIF

11
  • 1
    +1 Good magic - it works. It would be nice if it tied into the same volume bar that pops up with the regular volume buttons. Sep 15, 2015 at 18:36
  • 13
    mute/unmute: amixer -D pulse sset Master toggle Sep 15, 2015 at 18:38
  • I used your commands but the Volume up shortcut actually lowers the volume instead though it works normally in the terminal. What's going on?
    – user10853
    Sep 2, 2016 at 22:59
  • Make sure you typed 5%+ not 5%- for volume up. Sep 3, 2016 at 19:05
  • 6
    The volume up/down shortcuts don't work in Ubuntu 16.04 with Gnome3. The Mute shortcut, however, does. The up/down commands work if I use them in a terminal manually. I noticed the shortcuts instead set the values to 0%, implying a command parsing bug. An imperfect workaround is to use raw values instead -- e.g. amixer -D pulse -R sset Master 3277+ and amixer -D pulse -R sset Master 3277-. The actual number may vary depending on your device. My max raw value was 65536. Jul 13, 2017 at 19:01
24

Open System Settings, go to Keyboard, then the Shortcuts tab, and finally choose Sound and Media in the list on the left. You can then choose the Volume related items in the list on the right side, and select which keybinding to use.

(Reverse usage of left and right here, for RTL languages.)

3
  • This works, but it also disables the built-in Volume control buttons on my laptop. Anis' answer above allows those to still work. Jul 13, 2017 at 19:21
  • 1
    That wasn't a requirement of the question asked, and also depends on how the volume control buttons are implemented. Also, this question is 5 years old, and Ubuntu 12.04 is End of Life now.
    – dobey
    Jul 13, 2017 at 19:41
  • 1
    A suggestion for non multimedia keybindings: Volume Up ALT + PageUp, Volume Down ALT + PageDown, Mute ALT + Pos1. Though it is more of a Windows standard to use the PageUp and Down keys for volume it is mapped in a lot of software, too. Still, Firefox uses STRG + Page Up to switch between Tabs so just use ALT.
    – somethis
    Aug 14, 2019 at 9:37
5

Usually, this command works just fine as a command for lowering the volume (Ubuntu 16.04):

amixer -q -D pulse sset Master 5%- 

On Ubuntu 18.XX (Gnome) escape the % symbol:

amixer -q -D pulse sset Master 5%%-

Worked for me!

2
  • 2
    I just want to stress out, that the escaping is only needed for a new hotkey, not on the terminal itself.
    – Tobias S
    Nov 6, 2018 at 7:28
  • As of 19.04 the escaping doesn't seem to be necessary even for the hotkey Dec 10, 2019 at 19:10
-1

I had the same type of issue, I can confirm this syntax works:

amixer set Master 5%%-
amixer set Master 5%%+

Also be sure to not use - or + characters inside your custom shortcut name. I first used "Volume -" and "Volume +" which failed. Using "Volume up" and "Volume down" worked much better.

2
  • 1
    set? Should be sset, or?
    – abu_bua
    Nov 11, 2018 at 21:09
  • 1
    @abu_bua according to the manual, both set and sset are valid commands on 16.04 (the version I'm running)
    – Fabby
    Nov 12, 2018 at 22:18

You must log in to answer this question.

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