Spotify desktop notifications - Part 1

Some background

The Spotify desktop client on Linux which I had installed a long time ago used to emit a desktop notification, whenever a next track would play.

This notification would work for a few tracks then stop displaying for some reason (the debug logs were not helpful to identify the cause).

Another issue is that the deskstop client is closed-source so there was no way to analyse any code.

After checking the Spotify forums for answers.

A lot of people were complaining about this particular problem alas there were no solutions.

So, I decided to check whether anyone on GitHub had run into the same issue.

A solution ?

I came across the following repository - snotify

This person had in fact run into the same problem with notifications.

To analyse what the code was doing I decided to clone the repository.

  • The code was written in Rust which I was learning (and still learning) at the time so I decided to take a deeper look

  • It made use of the Linux communications message bus D-Bus

  • Makes use of existing external Rust libraries

Limitations

After building the program then running via cargo run.

Notifications did start to display.

However, only the track name plus the artist were displayed.

I was looking for something which matched what the Spotify client was displaying.

  • Track title

  • Track artist

  • Album title

  • Album art

Head over to Part 2 for details on D-Bus and Rust code examples.

Last updated on 5 Sep 2022
Published on 5 Sep 2022