Use chromecast_mpris to control Chromecast device from Linux desktop via MPRIS widget

chromecast_mpris Is a daemon that allows you to control Chromecast devices from the Linux desktop using MPRIS widgets. The tool can also be used to open media from the command line and play YouTube videos on Chromecast.

Support for MPRIS (Media Player Remote Interface Specification) is provided by default in Plasma Desktop and Cinnamon. GNOME has a simple MPRIS widget in the “Date/Time” menu (and there are also third-party extensions for this, such as MPRIS indicator buttonEtc.), there is also a command-line tool called playerctl, which is used to control media players that implement the MPRIS D-Bus interface specification.

chromecast_mpris uses GNOME Shell’s MPRIS indicator button extension to control my Chromecast

It’s worth noting that this program is only applicable to devices that implement the Cast v2 API (it uses PyChromecast To control Chromecast devices (such as Chromecast) and Cast-enabled devices (such as Google Home).

Even if it can play media with the help of Chromecast playerctl The purpose of the command chromecast_mpris is to be used as a remote control, just as the MPRIS interface can be used for other players that use this player, such as Rhythmbox, VLC, etc. Therefore, you can use it to play, pause, skip, fast forward, rewind on the Linux desktop, find and control the number of remote Chromecast devices.

Since this will expose the MPRIS controls for your Chromecast, you can also use the keyboard’s media keys to remotely control the Chromecast.

chromecast_mpris function:

  • Control video and music playback
  • View playback information in real time
  • Display thumbnail, title, playback position and media length
  • Search forward and backward, play, pause and stop playing
  • Volume up and down
  • Next and previous play
  • Opt out of serving apps
  • Open the media and play YouTube videos from the command line (using playerctl)

The program does not yet support playlists.

Below, you will find other screenshots of MPRIS widgets (under KDE Plasma and Cinnamon desktops), these widgets can use chromecast_mpris to control Chromecast devices:

chromecast_mpris KDE plasmachromecast_mpris Cinnamon Linux Mint

You may also like: How to use “cast to TV” to cast GNOME Shell desktop to Chromecast (with audio, Wayland/X11 support)

How to use chromecast_mpris and playerctl to play media/YouTube videos on Chromecast

To play media/YouTube videos on Chromecast, you need to know the device name.After installing and running chromecast_mpris, use the following command to get the Chromecast device name (you need to install playerctl If it is not installed, for example on Debian/Ubuntu: sudo apt install playerctl):

playerctl --list-all

Once you know the Chromecast name, please use the following methods to play media files:

playerctl --player MyDevice open "URL"

replace MyDevice With the device name, and URL With links to media files.

Example of chromecast_mpris project page:

playerctl --player MyDevice open ""

Or, to play a YouTube video:

playerctl --player MyDevice open "YoutubeURL"

replace MyDevice Use the Chromecast name and YoutubeURL to use the link to the YouTube video.


playerctl --player MyDevice open ""

You might also like: CATT command line Chromecast Player

Install chromecast_mpris

The tool is available on AUR for Arch Linux/Manjaro users, and on PyPI can also be easily installed on any Linux distribution using PIP.

After the installation is complete, run it, and you will be able to control Chromecast through the MPRIS widget:


I only have one Chromecast device, so I am not sure about the behavior of chromecast_mpris when multiple devices are available. [[Edit]]The tool does have options to specify which Chromecast device to use:

chromecast_mpris --name "MyDevice"

where is it MyDevice Is the name of the Chromecast device.

You can also specify the streaming device IP or hostname (--host), its UUID (--uuid), if the device is not found, you can also choose to retry after the specified number of seconds (--wait). See the application help (--help) For more information.

If you want to add it to the startup application, and you have installed this file using PIP, make sure to enter the full path of the executable file (/home/YOURUSERNAME/.local/bin/chromecast_mpris).

More articles related to Chromecast from Linux Uprising:

  • fx_cast adds Chromecast support to Firefox
  • How to use pulseaudio-dlna to stream audio to Chromecast device on Ubuntu 20.10 / Ubuntu 20.04 / Linux Mint 20.x
  • The Cast To TV v12 Chromecast extension for GNOME Shell adds features such as automatic image slideshow, audio only transcoding, etc.
  • Use Gnomecast to cast videos to Chromecast on Linux


Related Posts