Many desktop keyboards have media playback buttons that the user can use. This to pause, stop, jump and play music with the press of a button. For the most part, the linux kernel and Linux operating systems, have support for these devices. Due to the greater development of Linux drivers over the years. That said, not all multimedia keys on each keyboard are factory compatible, and that is a real shame.
Now, if you're looking to get your play, pause, stop and skip buttons on the keyboard. To work with your favorite open source media players, you've come to the right place. You just have to follow these instructions that we show you below.
Multimedia keys: Install Playerctl
First, Playerctl is important to enable the functionality of multimedia keys on keyboards that are not natively supported for Linux. Playerctl is compatible with most Mpris-based music players. Which means that, when linked to your multimedia keys, you can control the playback of Spotify, Clementine, Google Music Player Desktop and many others.
Similarly, the installation of Playerctl is necessary before starting, since the software is not preinstalled on any Linux distribution ready to use. To make it work, you must open a terminal window using the keys: CTRL + ALT + T or CTRL + SHIFT + T. Then, follow the instructions on the command line that correspond to the distribution you are currently using.
Ubuntu Linux
In this distribution, Playerctl is only available for users of 19.04. Therefore, if you plan to repair multimedia keys and have an earlier version of Ubuntu, maybe it would be time to update.
To install the application in Ubuntu, you must use the following apt command.
sudo apt install playerctl
Debian distribution
Debian Linux users have access to Playerctl in the "Main" software repository. Provided they upgrade to version 10 of the operating system. Then, if you have not already done so, update version 9 to 10. Then, use the apt-get command below to install Playerctl.
sudo apt-get install playerctl
Linux arch
Also, the Arch Linux “Community” software repository provides Playerctl. Therefore, to install it, make sure that this repository is configured in your Pacman configuration file. Once the software repository is enabled, use the installation command below to make it work.
sudo pacman -S playerctl
Fedora
Similarly, the Fedora Linux distribution has Playerctl in the primary software repository for versions 29 and 30. To install, you must open a terminal window and use the dnf command below.
sudo dnf install Playerctl
OpenSUSE
The OpenSUSE Tumbleweed and Leap distributions have access to Playerctl through the Oss software repository. Similarly, to install Playerctl, no configuration is required. Instead, start a terminal window and enter the following command below.
sudo zypper install playerctl
Multimedia keys: basic Playerctl functions
Also, Playerctl can be used to do many things with Mpris-enabled media players in Linux. Here is a list of the functions and how to use them.
playerctl play: starts media playback. This is perfect to set up on a dedicated button called «play».
playerctl pause: pause media playback. It is useful for those with a dedicated pause button.
playerctl play-pause: a combined command that stops and resumes multimedia playback. In turn, it is ideal for linking to a multimedia playback and pause key.
playerctl stop: stops media playback. It is often not necessary to link, unless the user has a dedicated multimedia key, called "stop".
playerctl next: jumps to the next media item in the playlist and plays it automatically. It's good when you link it to the "next" button.
playerctl previous: jumps to the previous media item in the playlist and plays it automatically. It is also ideal for linking to the "back" media key.
In addition to the basic functions of the player on the list just mentioned, Playerctl does more. Similarly, if you want more information, you must type "man Playerctl" on the command line to see the instruction manual of the software. Also, you can save the manual in a readable text file with: man
playerctl> ~ / playerctl-manual.txt
Assign Playerctl functions on multimedia keys in Linux
Now that the Playerctl program is installed on your computer with Linux and you know its basic command line functions. It is time to link some functions to multimedia keys.
Multimedia keys: Gnome shell
1.- First, press the Windows key on the keyboard. Search for "keyboard" and open the application with that name.
2.- Now, you must scroll to the end of the list of shortcuts and click on “+”.
3.- assign a name to your personalized shortcut, writing the name in the “Name” box.
4.- Check the list of basic commands above and complete the command you want to link. This in the "command" box.
5.- Now, you must click on “set shortcut” and press the multimedia key to which you want to link the command in Gnome.
6.- Click on “Add” to apply the shortcut.
Finally, repeat this process to link each of the functions to all your multimedia keys.
KDE Plasma 5
1.- Press the Windows key on the keyboard. Now, look for "custom shortcuts" and open the application with that name.
2.- Now, search for “Edit” and click with the mouse. Then, select "New," followed by "Global Shortcut." And finally, "Command / URL."
3.- Select “Action” and type the playerctl command you want to add to the shortcut. You can also check the list of basic commands above if you need extra help.
4.- In the same way, choose “Trigger” (Trigger) and press the multimedia key on the keyboard to which you want to link this command.
5.- Select “Comment” and enter the name of the personalized shortcut.
6.- Click on “Apply” to configure the shortcut.
Finally, you must repeat this process to link all multimedia functions to KDE Plasma 5.
Mate
1.- First, you must open the system configuration, search for “Keyboard shortcuts” and select it to access the keyboard shortcuts area of Mate.
2.- Now, search for “+ Add” and select it to create a new keyboard shortcut.
3.- In “Name”, you must write the name of the shortcut you wish to create. Then, select “Command” and type one of the commands listed in “basic commands”.
4.- click on “Apply” to add the new shortcut to Mate.
5.- Look for the personalized shortcut you just created in Mate. Then, double-click on the “disabled” area to re-link it to a multimedia key.
Finally, repeat this process to link all Playerctl commands in Mate.
XFCE4
1.- First, you must open the XFCE4 system configuration by pressing the ALT + F2 key. And typing the following command:
xfce4-settings-manager
2.- Search for “Add” and click to create a new custom shortcut.
3.- You can see the list of “basic commands” and type the playertcl command that you want to add to the new shortcut.
4.- Press the multimedia key to which you want to link the command.
5.- now, select “Close”, so that the shortcut window does. And your new shortcut should be working instantly.
Finally, repeat this process as many times as necessary so that you can configure Playerctl in XFCE4.