I've moved from Gnome to i3 on Manjaro, and I'm almost done with configuring the window manager, and terminal colors and whatnot. After some time I just decided to listen to some music, and after a couple of minutes I realized that the volume keys and playback keys don't work.

I have a Razer Blackwidow Stealth 2014 keyboard, so those media keys are actually together with the Function keys. For example: Play/Pause is on F6, and it acts as a media key when I press the Fn key, like in Fn + F6.

  • I tried to clean up this question because frankly about 90% of it was just wrong. Now it's fine, and you're answer clears it up. Two of the very things you had your answer prev/next were exactly in your answer. The only real improvement in was moving play to play/pause (which makes no difference to whether or not it works at all). Moreover, the xev command was totally bunk. If that was the output of xev when you hit those keys your answer would work. Try it again. Your state should say something XF86AudioNext and the like. – Evan Carroll Nov 28 '18 at 11:14

The search for the answer

After some time messing around with the controls, I've found a post on the old i3 FAQ board: https://faq.i3wm.org/question/3747/enabling-multimedia-keys.1.html

It says to paste the following into i3's .config file (bellow is a lightly modified version, with some lines removed, which are not relevant to this particular question):

# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness

# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPause exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

And it didn't work either, however the process of finding the answer is correct.

The real answer

To me, at least, the problem was that after copying those lines, the keys would not work. After some more research, I found out that the volume commands could be a little different, using amixer instead of PulseAudio's pactl.

At the end, those were left like this:

# Media volume controls
bindsym XF86AudioMute exec amixer sset 'Master' toggle
bindsym XF86AudioLowerVolume exec amixer sset 'Master' 5%-
bindsym XF86AudioRaiseVolume exec amixer sset 'Master' 5%+

and they started working.

The playback keys were a little more trickier. I deduced that the .config tells which command is executed to do the action. Then I proceeded to try playerctl play-pause on my terminal. Of course it didn't work, because playerctl was not installed. After installing it (using sudo pacman -S playerctl) those keyboard commands worked just fine too.

  • For the volume control, the first way worked for me by changing the sinks to 1 instead of 0. You can see your sinks by doing pactl list | grep sink – Ramzi C. Apr 16 at 1:10

i just replaced 0 with one example:

Pulse Audio controls

bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 1 +5% #increase sound volume bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 1 -5% #decrease sound volume bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 1 toggle # mute sound

to see what number is for your audio device open pavucontrol and click output devices the top one is 0 under that is one etc

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.