Episode: 4033 Title: HPR4033: Using playerctl to control media players Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr4033/hpr4033.mp3 Transcribed: 2025-10-25 18:51:51 --- This is Hacker Public Radio Episode 4,033. For Wednesday the 17th of January 2024, today's show is entitled, using player CTL to control media players. It is hosted by Ken Fallon and is about six minutes long. It carries a clean flag. The summary is, Ken Maps, some player CTL commands to keyboard shortcuts in LXQT. You are listening to a show from the Reserve Q. We are airing it now because we had free slots that were not filled. This is a community project that needs listeners to contribute shows in order to survive. Please consider recording a show for Hacker Public Radio. Hi everybody, my name is Ken Fallon and you are listening to another episode of Hacker Public Radio. This one is coming from the Reserve Q, which means two things, number one. We don't have shows, so we've had to take some out of the pool. And number two, of course, that we obviously now have one less show in the Reserve Q. So if you want a post to show or a reserve show, feel free to do that this weekend. So today I want to talk to you about how I solved a problem with multimedia playback in Firefox. On my phone, I can press play and pause with headsets, adapters and digital pause. So I assumed that this was available on Linux as well. On some of the keyboards, I have dedicated play, pause, fast forward, rewind keys. On the keyboard and work, I have those keys, but they're hidden behind a function key. And what I wanted to know was, how is that actually controlled within Linux? When I searched on Firefox, I found a sporting article on the Mozilla website, control audio or video playback with your keyboard. And that is using the M-P-R-I-S, which brings you to the page on the divos specification on free desktop.org. And it says that the media player remote interface specification is the standard divos interface, which aims to provide a common programming API for controlling media players. It provides a mechanism for discovering, querying basic playback control of compliant media players as well as trackless interface, which is used to add context to the active media items. Perfect. That's what I'm looking for. And then a quick search on command line control for that. I got to the excellent article from Derrick Diner on addictive tips. How to fix media keys, networking and Linux, obviously, links to all of these will be in the show notes. And it's a utility called player C-T-L, player C-T-L, all one word. And if you do a man player C-T-L, after you install it, instructions on the article on how to install it will show you how that's done. And the man page says the player control utility controls MP or IS enabled media players. In addition to offering play, pause and stop control, player C-T-L also offers previous and next track support, the ability to see backwards and forwards in the track and volume control. Player C-T-L also supports displaying metadata, artist title and album for the current track and showing the status of the players. That can be controlled using player C-T-L, include audacious, CM, US, MopedE, MPD, etc., Rhythmbox, VLC and it can also be used to control web browsers, apart from phrasing there a little. So the important ones are player C-T-L space play, which will start playback, player C-T-L space, pause and the one I'm using, player C-T-L space, play dash, pause, that's all more murder, play dash, pause, player C-T-L stop, player C-T-L next, player C-T-L previous. So of those three, I wanted to map the player C-T-L play dash, pause to my play, pause, player C-T-L next to my fast forward button and player C-T-L previous to my back button, which under LXQT which I'm running is fairly easy to do, you go press the start menu and type in shortcut and you get shortcut keys control and then by pressing add you can press you a edit action which has got shortcut, description, type and command. So if you click on the shortcut and then press whichever button that you want to, in my case for example, function and then I think it's function and pause and then I put in the command into the description because that's easier and then under type I have command or deboss message so I put in command and I press player C-T-L space, play dash, pause. Now probably looking at this could have put in the deboss message there but I find that putting in the command is more understandable for me when I come back and do it again and that was it, when I was done Firefox was playing and pausing and it was absolutely perfect. So hope that show was of interest to you and if you have any quick tips of the day today I learned stuff you can submit it to either a regular show or you can add it to the reserve queue like this one if you don't care when it's going to come out. So tune in tomorrow for another exciting episode of Hacker Public Radio. You have been listening to Hacker Public Radio at HackerPublicRadio.org. Today's show was contributed by a HBR listener like yourself. If you ever thought of recording podcasts and click on our contribute link to find out how easy it really is. Hosting for HBR has been kindly provided by an honesthost.com, the Internet Archive, and our syncs.net. On the Sadois status, today's show is released under Creative Commons Attribution 4.0 International License.