3

I'm wondering how to bind the media keys of my laptop to cmus play/pause next/previous. I've tried to use the bind common audioplay player-pause and variance commands to simply try to do what I want.

I can't seem to figure out the correct 'key names' for the media keys, and I'm not sure if cmus will be able to understand them when running in the background. I've found fixes for OS X such as this but I see no ways to make this work on Ubuntu. Is it possible, if so, how?

6

cmus has remote-commands that you can assign in your keyboard shortcuts config

cmus-remote --pause   #Play/Pause
cmus-remote --next    #Next song
cmus-remote --prev    #Previous song
cmus-remote --stop    #Stop
cmus-remote --seek -5 #Rewind 5 seconds
cmus-remote --seek +5 #Forward 5 seconds

E.g

enter image description here enter image description here

I only have one problem left.

Every time I press the Audio Play key from my headphones, Ubuntu shows the notification below and the shortcut is not executed, but if I wait the notification to disappear and press it again, it works.

enter image description here

3
  • I had to remove the current media keys assignments and create new ones for Cmus as described in here. This answer should be accepted. :) – Mokkun Oct 16 '19 at 10:48
  • Did you figure out how to hook up the headphones to the media controls? It's not working for me at all, I can only use keyboard shortcuts. – dspacejs Sep 26 '20 at 12:55
  • My headphones' buttons were already recognized as media buttons. So I just pressed them when configuring the shortcut – Madacol Sep 27 '20 at 18:32

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.