Intro
Started using a Corsair Gaming K70 Lux keyboard with brown Cherry MX-keys with my linux computer (originally a Ubunte Mate 18.04, now modded to Kubuntu 19.10). I love the distictness with the keys, although it's a bit loud when I'm "in the zone" and typing full-speed.
Anyway, it worked fine with a HP Elitebook 850 G5, but when connected to my stationary homebrew computer only the volume control roller and mute button worked.
Fiddling with the BIOS-button did nothing for me. Obviously some research was needed.
Most info I found on the forums was with Windows, so not really useful.
Then I came across this question over at Askubuntu, that got me thinking about a previous article I'd written about using d-bus commands to control Spotify and bind them to Mate panel buttons. See Control Spotify in Linux for more info!
Assumtions
You're using a linux computer with KDE Plasma v5. This probably works with earlier versions as well, but of course - YMMV.
How-to
- Start System Settings.
- Go to the Workspace subsection in the left panel and then click Shortcuts.
- Choose Custom Shortcuts in the middle panel.
- Right-click in the Name panel and choose New/Global Shortcut/D-Bus Command.
- Enter eg Play-Pause for a name.
- Enter a comment as need in the Comment tab.
- On the Trigger tab, click the button and press the Play-Pause button on the K70 keyboard. It should register the new key and ask if you want to reassign the key. Choose Yes and continue.
- On the Action tab there are four fields, but only the first three are really needed. Copy and paste the below in respective field.
Remote application: org.mpris.MediaPlayer2.spotify
Remote object: /org/mpris/MediaPlayer2
Function: org.mpris.MediaPlayer2.Player.PlayPause - Click apply.
- Repeat steps 4-9 for the Previous, Next and Stop buttons, using the info below.
Remote application: org.mpris.MediaPlayer2.spotify
Remote object: /org/mpris/MediaPlayer2
Function: org.mpris.MediaPlayer2.Player.PreviousRemote application: org.mpris.MediaPlayer2.spotify
Remote object: /org/mpris/MediaPlayer2
Function: org.mpris.MediaPlayer2.Player.NextRemote application: org.mpris.MediaPlayer2.spotify
Remote object: /org/mpris/MediaPlayer2
Function: org.mpris.MediaPlayer2.Player.Stop - Note that https://userbase.kde.org/System_Settings/Shortcuts_and_Gestures/en#Examples_using_D-Bus writes "Prev".
This doesn't work, however "Previous" from paragraph 10 does. - You should now be able to control eg Spotify with the multimedia buttons on your Corsair K70 keyboard.
Sources
https://askubuntu.com/questions/990284/media-keys-not-working-on-ubuntu-17-10
https://forum.kde.org/viewtopic.php?f=289&t=128966
https://userbase.kde.org/System_Settings/Shortcuts_and_Gestures/en#Examples_using_D-Bus