You are not logged in.

#1 2025-01-18 12:48:58

drtebi
Member
Registered: 2013-02-09
Posts: 148

cmus: Is it possible to bind media keys?

Hello,

I have recently started to use cmus for playing music and like it quite a bit.

I do find the z x c v b key bindings a bit weird though. On my laptop I have these "dual function" F keys (they can work as normal F keys, or as media keys, depending on which mode is switched on). They have "previous" - "pause/play" - and "next" on the keys F5 F6 F7. It would be great to bind these keys to the corresponding cmus commands, since the keys are painted with the corresponding symbols... which would visually make the use of these keys easier and more logical...

So I understand I would have to do e.g.:

:bind player-pause <key>

But the problem is that nothing shows up when I press F5 to enter the key.

Is there a key code I can enter, or is this simply not possible?

Thanks,
DrTebi

P.S.: I am using cmus through a terminal, connecting to a RaspberryPi

Offline

#2 2025-01-28 07:10:28

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 569
Website

Re: cmus: Is it possible to bind media keys?

These keys are usually in a different format (it's missing XF86AudioPlayPause-something
You can also read the names from the commands "xev" (Xorg) or "wev" (wayland), both available in the repos.

This is for normal DE/WM's though, so you might need to get the terminal keycodes.
You'll need to disable these keys in your DE/WM so they aren't just intercepted by it.
Open a shell were they are not escaped/already bound, in the worst case use "dash" which doesn't bind anything but very basic features, press the button, and copy over the keycode it gives you.

edit: perhaps google first next time: https://askubuntu.com/questions/1059279 … ys-to-cmus, depending on WM/DE the first paragraph of my answer should be helpful too.

Last edited by jl2 (2025-01-28 07:11:51)


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Offline

#3 2025-01-31 18:06:25

drtebi
Member
Registered: 2013-02-09
Posts: 148

Re: cmus: Is it possible to bind media keys?

Thank you for your help.

I did google for this issue, but non of the results I found were related to the media keys.

Anyway, I will try to follow your instructions and hopefully get it to work.

Thanks again,
DrTebi

Offline

#4 2025-02-03 12:50:37

Halano
Member
From: Egypt
Registered: 2023-02-07
Posts: 47
Website

Re: cmus: Is it possible to bind media keys?

bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause
bindsym XF86AudioNext exec --no-startup-id playerctl next
bindsym XF86AudioPrev exec --no-startup-id playerctl previous
bindsym XF86AudioStop exec --no-startup-id playerctl stop

i3 / cmus / playerctl
never tried media keys directly into cmus.


.: HalanoSiblee The Smart Moth :.

Offline

Board footer

Powered by FluxBB