FWIW, KDE Plasma already has something similar to Lofi that I use daily https://i.imgur.com/uVAnf7p.png . Works out of the box :)
Under the hood it uses MPRIS to talk to the Spotify Linux app. So it works with all native music players, and even YouTube running in your browser! https://www.omgubuntu.co.uk/2018/05/kde-plasma-5-13-features...