Contents[Show]

1. 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!

 

2. Assumtions

You're using a linux computer with KDE Plasma v5. This probably works with earlier versions as well, but of course - YMMV.

 

 

3. How-to

  1. Start System Settings.

  2. Go to the Workspace subsection in the left panel and then click Shortcuts.

  3. Choose Custom Shortcuts in the middle panel.

  4. Right-click in the Name panel and choose New/Global Shortcut/D-Bus Command.

  5. Enter eg Play-Pause for a name.

  6. Enter a comment as need in the Comment tab.

  7. 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.

  8. 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

  9. Click apply.

  10. 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.Previous

    Remote application: org.mpris.MediaPlayer2.spotify
    Remote object: /org/mpris/MediaPlayer2
    Function: org.mpris.MediaPlayer2.Player.Next

    Remote application: org.mpris.MediaPlayer2.spotify
    Remote object: /org/mpris/MediaPlayer2
    Function: org.mpris.MediaPlayer2.Player.Stop

  11. 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.

  12. You should now be able to control eg Spotify with the multimedia buttons on your Corsair K70 keyboard.

 

 

4. 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