Can’t make media keys work on i3 window manager

i3-window-managerkeyboard

I can't seem to get how to get media keys to work in i3 gaps on my Corsair K30.

I have added into config the following line but

bindsym XF86AudioNext       exec --no-startup-id playerctl next
bindsym XF86AudioPrev       exec --no-startup-id playerctl previous
bindsym XF86AudioPlay       exec --no-startup-id playerctl play
# bindsym XF86AudioStop     exec --no-startup-id playerctl pause
bindsym XF86AudioStop       exec --no-startup-id gnome-terminal

they work in a strange way. XF86AudioStop is completely ignored. I tried to test it and see if it will open gnome-terminal for example. Play works but pause doesn't. If I go to kde desktop all media keys and everything works without an issue. But in i3 I can't setup bindings neither for volume keys nor for media keys. Managed only to make next and previous buttons work with the config above.

Is there any kind of app that display which XF86 key is pressed or outputs it to terminal?

What am I missing?

Thanks in advance.

Best Answer

Make sure you have the correct keysym in the first place – for it should be XF86AudioPause, for ▶ / ⏸ it might be XF86AudioPlayPause, or it might even be something completely different. (XF86AudioStop is the "Stop" button.)

The keysyms for volume controls should be XF86AudioRaiseVolume, XF86AudioLowerVolume, and XF86AudioMute.

For checking X11 keysyms of a key there's xev and xbindkeys --key. (Note that they often won't see keypresses for already globally-bound keys, so don't use them in KDE.)

(Low-level evdev keycodes can be obtained with evemu-record or libinput debug-events; they're not the correct kind of code, but are useful to see whether the key is recognized at all by the kernel.)

Related Question