I've been making an effort for a while to hit like on songs I like, mainly so I can always fail over to a playlist of liked songs. I generally use GPMDP as my main player and Polybar as my taskbar. I control my media player using playerctl and a while back I wrote songliker
to set up a shortcut to like my songs. I decided to put it all together into a neat little polybar module and thought others might enjoy this.
I'm including the necessary files to do this yourself, although this might not work for you 'as-is' since I have a pretty customized systemd service management set up. Easiest way would be to just ignore the systemd stuff and just add an exec now_playing
, but I'm including it here in case you want to use it and just modify that.
This will display the currently playing song in your bar in the following format {artist} - {song} | {liked?}
. It uses Nerd Font symbols for a prefixing musical note and a thumbs up outline if not liked, or full if liked. It will also truncate the song name to fit the whole message into MAX_LEN
characters.
It has the following inteactions:
- Left Click - Play/Pause
- Right Click - Next Song
- Double Click - Like Song
- Set up polybar to use some type of Nerd Fonts, or include those symbols, or adjust the symbols to your liking
- Install
playerctl
- Install any missing python dependencies (might just be
websockets
- Run
songliker
once on the command line to register it against GPMDP. It'll prompt you for a code, but once you've set it up you won't have to worry about it again since the auth is saved.
Added signal handler to clear song on exit (using
SIGTERM
which is the systemd default... not sure if this is the best overall signal tho)