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?

1 Answer 1

7

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, 2019 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.
    – Daniel
    Sep 26, 2020 at 12:55
  • My headphones' buttons were already recognized as media buttons. So I just pressed them when configuring the shortcut
    – Madacol
    Sep 27, 2020 at 18:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .