I often have my audio player (usually Audacious v. 3.9) running while the Chrome browser is also running. If I open a video in Chrome, it seems to "claim" MPRIS controls from the audio player. The only way to get my shortcut keys to control Audacious is to close Chrome.

There must be a way of preventing MPRIS from recognizing Chrome as a "media player". I assume the problem is that one (or both) of these apps is not "claiming" MPRIS functions properly. According to the man page, this relates to an MPRIS_REMOTE_PLAYER variable:

If unset or set to *, mpris-remote will communicate with the first player it finds registered under "org.mpris.*" through D-BUS. If you only have one MPRIS-compliant player running, then this will be fine. If you have more than one running, you will want to set this variable to the name of the player you want to connect to. For example, if set to foo, it will try to communicate with the player at "org.mpris.foo" and will fail if nothing exists at that name.

My problem is that I don't know how to set this variable. I've looked in the D-bus editor for something corresponding to this (on the analogy in an answer about media-players in the tray), but there is no relevant setting there that I can spot.

Meanwhile, I have discovered this:

$ qdbus org.mpris.*

So it seems Audacious does have its "own" MPRIS identity, so how can I prevent Chrome from being recognized as a "media player" for MPRIS purposes? Any help with setting that up would be greatly appreciated.

P.s. I'm on Ubuntu 18.04 LTS.


While it would still be good to know if there is an "MPRIS-managed" solution to this problem, there is a work-around using the settings in Chrome itself.

It seems Chrome is quite aggressive in "taking over" control of media keys/shortcuts. This can be disabled by following these steps, found in a post on the GHacks.net site:

You may disable the Hardware Media Key Handling flag in Chrome currently to prevent Google Chrome from restricting media keys access. Here is how that is done:

  1. Load chrome://flags/#hardware-media-key-handling in the Chrome address bar; this should open the right flag when loaded.
  2. Set the Hardware Media Key Handling flag to Disabled.
  3. Restart Google Chrome.

When I set this toggle on my machine, Chrome offered a "Relaunch" button which restarted the browser with the tabs from the previous/re-started session intact.

This takes care of my issue—with the caveat that if there is an MPRIS "solution" (i.e., use the MPRIS spec to "hide" a potential media-player), I would still like to know. ;)

  • 2
    perfect! this is exactly what fixed it for me as well. thank you! Dec 31 '19 at 18:29

I have just "discovered" Playerctl (or, on Github). playerctl is a wonderful command line tool that solves some (all?) of OP's problems. From the official "About":

Playerctl is a command-line utility and library for controlling media players that implement the MPRIS D-Bus Interface Specification. Playerctl makes it easy to bind player actions, such as play and pause, to media keys. You can also get metadata about the playing track such as the artist and title for integration into statusline generators or other command-line tools.

For more advanced users, Playerctl provides an introspectable library available in your favorite scripting language that allows more detailed control like the ability to subscribe to media player events or get metadata such as artist and title for the playing track.

It is a very simple way of using MPRIS controls while targetting particular media players, among much else besides. Worth having as an option in this Q&A, anyway.

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.