Want to control you favorite music player, but don’t have any media keys? Not a problem!

0
Want to control you favorite music player, but don’t have any media keys? Not a problem!

I looooove my Thinkpad – I really do, but it has no mediekeys and I listen to music every day. Therefore, It would be nice, if I could avoid constantly changing back and forth between windows to control my music. In comes Playerctl, which is a small utility to control i.e. Spotify, vlc, audacious, bmp, xmms2. So how does it work? Well, start by installing playerctl
sudo pacman -S playerctl

Thereafter, read the helpfile
playerctl -h

A very simple application indeed. It only has a few commands which can be issued. Start a playing a song with Spotify and open a terminal and type
playerctl -next.

It changed the song right? Pretty cool huh! But, we don’t want to open a terminal each time, we want to listen to another track. We want medieakeys! Open your i3-wm config. Here you can specify which key combos that should issue the playerctl command
nano ~/.config/i3/config

The below example is what I put in my i3-config. Before you type this in and save, please note that these key combinations could already be in use for other things. So if you want the exact same setup as me, you need to make sure they not already being used. As you can see, this makes my arrow-keys act as media keys when used in conjunction with the modkey, in my case the windowskey. However, you could assign almost any keys for these commands. Just make sure that they are not already being used for something else.

bindsym $mod+Up exec playerctl play-pausestuff
bindsym $mod+Shift+Down exec playerctl stop
bindsym $mod+Shift+Right exec playerctl next
bindsym $mod+Shift+Left exec playerctl previous

That’s it.

LEAVE A REPLY