Set The Currently Playing Spotify Song Title And Album Cover As Your GNOME Wallpaper With This Script

Blueberry currently playing Spotify song and GNOME desktop wallpaper

Blueberry is a new Python scripts that sets your currently playing Spotify song title and album cover as your GNOME desktop wallpaper. To use it, you need Spotify Premium.

The wallpaper includes the album cover in the center, while also using the 2 main colors from the cover to paint the rest of the wallpaper. The artist and song title are also displayed on the wallpaper.

The script changes your background to the currently playing Spotify song album cover and song title, no matter how you listen to music on Spotify. You can use the native desktop app, the Spotify snap or flatpak packages, Spotify web, using some other desktop Spotify clients, and even Spotify running on your phone.

For authentication, the script requires creating a developer app, and using its client id and secret.

This Blueberry Python script does have a pretty important downside, though. You need to run it while a song is already playing on your Spotify account. If you run it while no song is playing, it will show an error and exit, so that means you can't add to startup, for example (it doesn't stop if you pause a song though). [[Edit]] This has been fixed, the script no longer exists if no song is playing on your Spotify account.

It's also worth noting that Blueberry changes the wallpaper using the gsettings set org.gnome.desktop.background picture-uri command, so it should work on any GNOME-based desktop that supports this, and not just GNOME (it didn't work with Cinnamon for me though, I'm not sure why). Also, if you use some other desktop environment, you could change this command to one that works for your desktop - the command is near the bottom in the main.py file.

I'm also not sure how this works with multiple monitors, as I'm currently using a laptop with no external monitors.

You might also like: Embed An Audio Visualizer On Your Linux Desktop Background Using GLava

Here are 2 more screenshots of desktop backgrounds generated by Blueberry:



How to run Blueberry Python script to set your GNOME desktop wallpaper to the currently playing Spotify song title and album cover


1. To use Blueberry to change your desktop wallpaper to the currently playing Spotify song, start by installing git (to get the source from GitHub) and python3-pip (to install the script dependencies):

  • Debian, Ubuntu, Pop!_OS, etc.:
sudo apt install python3-pip git

  • Fedora:
sudo dnf install python3-pip git

  • Arch Linux, Manjaro:
sudo pacman -S python-pip git

  • openSUSE:
sudo zypper install python3-pip git

2. Use pip3 to install the Blueberry dependencies:

python3 -m pip install --user --upgrade colorgram.py spotipy pillow

3. Next, get the latest Blueberry script code from GitHub:

git clone https://github.com/newpolygons/Blueberry

4. Now we'll need to create a new Spotify (requires a premium account) app. Go to https://developer.spotify.com/dashboard/applications, login with your Spotify account and click on CREATE AN APP. Pick an App name and App description of your choice, and click the CREATE button to create your application.

Once your application has been created, click on the green EDIT SETTINGS button (top-right) and add a new Redirect URI set to https://www.google.com/, then click the Save button (at the bottom).

Now on your new application page, you should see the Client ID, as well as a link that says SHOW CLIENT SECRET which displays your client secret. Copy the Client ID and Client Secret codes to the corresponding fields in the creds.txt file inside the Blueberry folder.

In this creds.txt file, you'll also need to fill in your Spotify username. You can see your username by going to https://www.spotify.com/account/overview/ and logging in with your Spotify account.

Also in the creds.txt file, change the display_size value to your display size. Remember to save the file when you're done.

5. Let's authenticate Blueberry with your Spotify account.

Open a terminal and navigate to the Blueberry folder, e.g.:

cd Blueberry

There, run:

python3 main.py

After running this command, a new tab will open in your default web browser. Login there to Spotify if you weren't already logged in, and then you'll be redirected to https://www.google.com/ followed by ?code= and a long code. Copy the entire URL back to the terminal where you ran the python3 main.py command, and press Enter

Next, play a song on your Spotify account using any client you want (Spotify desktop installed as a native package, snap or flatpak, Spotify on your phone, Spotify Web, etc.), and your GNOME desktop background should now change to the song that's currently playing in your Spotify client.

Use this python3 main.py command in the Blueberry folder every time you want to start the script. To add it to startup, use sh -c 'cd /path/to/Blueberry; python3 main.py' as the command (directly calling python3 /path/toBlueberry/main.py doesn't work due to the script looking for the certs.txt file in the current folder).

Tip: If you have a dock on the left-hand side of the monitor, and the currently playing song title gets behind the dock, open the main.py script from inside the Blueberry folder with a text editor, and change the 50 value from titleArtist.text((50 to something like 100 (you can try different values to see which best suits your needs).

Related: