What makes us different from other similar websites? › Forums › Tech › Fix USB Media Keys Not Working for Audio Players in Linux
Tagged: cmus, How to, kew, keyboard-shortcuts, Linux, media-keys, mpris, playerctl, terminal-audio, XFCE, Xubuntu
- This topic has 0 replies, 1 voice, and was last updated 4 weeks, 1 day ago by
thumbtak.
-
AuthorPosts
-
May 19, 2026 at 11:13 am #8483
thumbtakModeratorIf you are using an audio player in Linux—especially terminal-based players like
kew,cmus, or even certain desktop apps—you might find that your USB keyboard or headset media keys don’t work out of the box.This usually happens because background or terminal applications don’t automatically capture your desktop environment’s global keyboard shortcuts. Fortunately, modern Linux multimedia players support a standard called MPRIS (Media Player Remote Interfacing Specification). We can easily bridge the gap using 1 lightweight, universal command-line utility called
playerctl.Here is 1 quick guide to getting your physical media keys working seamlessly with any Linux media player.
Step 1: Install playerctl
playerctlis 1 universal command-line utility that acts as a bridge, sending “Play”, “Pause”, “Next”, and “Previous” commands directly to whatever media player is currently active.Open your terminal and install it via your distribution’s package manager:
For Ubuntu / Debian / Xubuntu:
$ sudo apt update && sudo apt install playerctlFor Fedora:
$ sudo dnf install playerctlFor Arch Linux:
$ sudo pacman -S playerctlStep 2: Bind the Keys in Your Desktop Environment (Xfce Example)
Now you need to tell your desktop environment to execute
playerctlcommands whenever you hit your physical media keys. Here is how to do it in Xfce/Xubuntu:1. Open your applications menu and navigate to Settings => Keyboard.
2. Switch to the Application Shortcuts tab.
3. Click the + Add button to create your 1st shortcut:• Command:
playerctl play-pause
• Click OK, then physically press your USB Play/Pause key to bind it.4. Click + Add again for track 2:
• Command:
playerctl next
• Click OK, then press your USB Next Track key.5. Click + Add 1 last time for track 3:
• Command:
playerctl previous
• Click OK, then press your USB Previous Track key.(Note: If you use a different desktop environment like i3wm, Openbox, or KDE, you would simply add these same playerctl commands to your respective configuration files or Custom Shortcuts menu).
Why this method works
Because
playerctlis smart, it will automatically detect and control whatever player is active—whether that’s 1 terminal client running in the background, Spotify, VLC, or even 1 YouTube video playing in Firefox.Note on Volume Controls: You don’t need to change your volume keys. Your Linux distribution’s default audio server (PulseAudio or PipeWire) already handles global system volume natively, which automatically controls the audio output of your players.
-
AuthorPosts
- You must be logged in to reply to this topic.
