One amazing thing about Linux desktops is the amount of integration you get. You certainly wouldn’t be able to customize all your applications to have a similar look to them on Windows! Aside from the larger things, this sort of integration has other, less noticeable perks as well.
Specifically, you can control your music in the comfort of your desktop, without even touching your media player — you can even hide it if you want. You’ll also be able to use your media keys (Play, Pause, etc.) to do this.
Talking to Media Players With MPRIS
A lot of Linux applications have the ability to communicate with each other. This is usually done using a special piece of software called D-Bus, which acts as a mediator for many programs. It’s D-Bus which lets Linux desktops integrate with media players in the form of MPRIS.
The Media Player Remote Interfacing Specification (MPRIS) is a subset of D-Bus’s features that’s used for controlling media players. As such, if you want your music or video player to integrate with your desktop, you’ll need one that supports it. Most of them will already do so, but some may need some extra tweaking to enable them.
As a thumb rule, it’s the video players which need adjusting (VLC is an exception to this). An example of this is GNOME Videos. You’ll need to enable MPRIS support by checking the Edit > Preferences > Plugins > MPRIS D-Bus Interface option.
Actually controlling these media players using MPRIS from the desktop however, requires a separate application. This process differs between desktop environments, but in general, they’re always part of the desktop itself.
Integration With Plasma, Unity, and Cinnamon
For many desktop environments, integration comes out of the box. As long as you have a media player that supports MPRIS, you won’t have to do much else. The three desktops above have excellent controllers, and don’t require setting up.
The MPRIS controller in the Plasma desktop is hidden in your system tray. Whenever you start up a media player, it’ll appear. From there, you can stop, start, and change your playback when you click on the controller. In addition to this, you can even keep the menu permanently up by clicking on the pin icon in the corner, useful as a miniature player.
If you want to disable this feature, you can do this in System Tray Settings > Media Player. Keep in mind that without this, your media keys won’t work!
MPRIS integration is a little more advanced in Unity, built into the sound applet. Once you’ve launched an audio or video player, it’ll show up as an entry in your volume menu. This provides an alternate way of starting them up.
If the sound menu is controlling a video player such as VLC, you’ll have less options to control it: play, pause, back, and forward. Audio players on the other hand, are a bit more malleable, as seen below.
This design makes sense. Video players are a visual experience, so controlling them from the desktop without looking at the content ruins their purpose. MPRIS has the additional benefit of making media keys, such as the ones on Macbooks, work across all players. You could use them as a convenient alternative.
Like Unity, the Cinnamon desktop has its MPRIS support built directly into its sound applet. Similarly, you also get the ability to open up the media player of your choice from the desktop’s volume menu.
There are a few (mainly cosmetic) differences however. If you enjoy larger album art, you might like the way Cinnamon goes about presenting your music as compared to Unity. The applet menu also provides you with a way of shutting down your media player — this is more of a feature for dedicated music players. In general, music players minimize themselves when they’re closed, so this provides you with a surefire way of killing them.
Advanced Integration in GNOME
Currently, the GNOME desktop has only basic MPRIS integration: media key control. To get something more advanced than this, you’ll need to download a GNOME shell extension called Media player indicator. You can install it by following this link.
Make sure to open it with Firefox or GNOME’s default web browser! This will let you install the extension through the webpage (in the form of a large ON/OFF button). If you’re using Firefox, remember to enable the Gnome Shell Integration plugin!
After you’ve installed this extension, it’ll appear in your system menu once you’ve opened up a MPRIS compatible media player. Like the Plasma desktop widget, you can control playback from it.
With the GNOME Tweak Tool installed, you can also customize the extension’s behaviour. For example, there’s an option to adjust media player volume levels. You can even make the extension persistent, so it’ll stay in your system menu even without a MPRIS compatible player open.
Using MPRIS With XFCE
Being a lightweight desktop, you need to install a media player controller for XFCE to make it work. This comes in the form of an XFCE panel plugin called xfce4-soundmenu-plugin. To get it, you’ll need to add a PPA repository from the Xubuntu team, containing the program. Enter these commands to do so:
sudo add-apt-repository ppa:xubuntu-dev/extras sudo apt-get update sudo apt-get install xfce4-soundmenu-plugin
In future, you may not even need to do this. The programs in them may be integrated into Ubuntu’s repository.
Adding the Plugin
Even after installing the plugin, you still need to add it to one of XFCE’s panels. To do this, open up the Panel Preferences window, by entering this line into your terminal:
Having done this, go to the Items tab, and click on the Plus sign. You’ll be greeted with a list of plugins you can add to your panel. If you scroll down near the bottom, you’ll find an entry called Sound menu Plugin. Once you select it, press the Add button, and it’ll appear in one of your panels.
Configuring the Plugin
To make the controller work, you need to tweak it a little first. Right click on the plugin and select the Properties dialogue. This will open up a configuration window.
You need to tell XFCE’s sound menu what you want it to control. If you don’t do this, it won’t work! Firstly, open up your media player of choice. After this, click on the refresh button in the Player text box. This automatically searches for opened media players.
One thing you might like about this setup is that you can move the controller around, unlike other desktop environments. There’s a lot you can customize the plugin to do as well. For example, I placed the plugin in a new (widened) side panel, and let it display album art.
Another useful thing I found was that the speaker icon was not for show: I could control the volume from it by scrolling up and down over it.
If you’re using an extremely lightweight desktop setup, such as Openbox, your integration will be limited to your media player keys (like GNOME without the extra plugin). This can also act as an alternative for people who don’t want advanced integration features. Unfortunately, this is not an option for desktops that tightly integrate their controllers, such as Unity and Cinnamon.
To achieve this, you’ll need a command line tool called Playerctl. For Ubuntu/Mint users, you can download the DEB file/program from here. Installation should be easy as double clicking on the download.
This tool will try to automatically control any media player that supports MPRIS using terminal commands. All commands are preceded with the word playerctl, followed by a command, like so:
If you want to use the program for more, enter in playerctl –help to see what else it can do.
However, this isn’t an ideal way to control a media player. Instead, you create keyboard shortcuts that execute these actions, as seen below.
For very lightweight desktops, you might have to manually enter in which shortcuts you’d like to use. For such systems, here some keyboard symbols you might need:
These symbols match to commands that playerctl has. Most desktops will just let you press your media keys to map them to a command — quick and simple.
Enjoy Seamless Control!
While it may not be one of the most flashy parts of the desktop, integration with a media player makes the whole experience that much better. Yes, it might not be needed, but put together with many other things, it shows just how amazing Linux can be.
What features do you love about your Linux desktop?
Image Credit: natrot via Shutterstock.com