esenliyim / sp-tray

Gnome extension to display spotify metadata
GNU General Public License v3.0
55 stars 22 forks source link

Issue/Question: Path of the Spotify logo used in the panel #26

Open illegalmushroom opened 2 years ago

illegalmushroom commented 2 years ago

Hi, I really appreciate the work you've done on this extension, but I have a question regarding the Spotify logo option. Where is the path to the icon used by the extension, because I want to modify it and hopefully fix the issue I'm having (seen below). Thanks in advance! image

esenliyim commented 2 years ago

That feature was introduced by #20. Not my creation, and admittedly one of the things I need to take a closer look at and understand better.

That problem occurs when Spotify is installed as a containerized/sandboxed package, like Snap or AppImage or Flatpak, which I'm guessing is how you have installed it on your machine.

I haven't done any real investigating yet, but my educated guess is that the icon comes from wherever your system stores application icons by default, you know, where desktop entries and whatnot get their icons from. That'd explain why the icon is not present when the Spotify client is running in a sandbox. Missing application icons is unfortunately an annoyingly common problem with snap/flatpak/appimage packages. One solution to that would be packaging the icon with the extension so it doesn't have to rely on the system to provide it.

illegalmushroom commented 2 years ago

You're right, my Spotify is indeed installed as a Flatpak. I'll try to see if I can get it to play nicely, in the meantime it's up to you if this issue should remain open or not. Thanks for the clarification!

e7d commented 2 years ago

Hi @esenliyim and @illegalmushroom,

Having this issue since i upgraded from Fedora 35 to Fedora 36, I investigated a bit this morning, and it seems something changed in the way icons are handled. And I guess Gnome 42 is the culprit here.

From what I reckon, the icon is loaded here: https://github.com/esenliyim/sp-tray/blob/master/panelButton.js#L142

this.ui.set("icon", new St.Icon({
    icon_name: "spotify",
    style_class: "system-status-icon",
}))

As @esenliyim expressed himself, loading icons this way loads them from the system using a name as a reference. This icon catalog can actually be consulted using the app "GTK Icon Browser". On my Fedora 36, the binary for the latest GTK version (GTK4) can be installed by fetching the gtk4-devel-tools package, giving you the gtk4-icon-browser binary amongst others.

Launching it and browsing a bit, you can see the spotify icon does not exists (anymore?). image

As @esenliyim said:

One solution to that would be packaging the icon with the extension so it doesn't have to rely on the system to provide it.

But what about copyright, at least with the official one? :shrug:

The say here https://developer.spotify.com/design/content/ : image More details here, but did not read it all: https://developer.spotify.com/terms/

Maybe asking them kindly on their community forum would suffice after all, arguing this is open-source software?

In any case, I gave it a try on this commit, with nice results: image image

e7d commented 2 years ago

Maybe asking them kindly on their community forum would suffice after all, arguing this is open-source software?

No need to go on their forum, the link "approved by Spotify" we can see on the screenshot is actually a form to ask for approbation. It directs here: https://spotify.atlassian.net/servicedesk/customer/portal/3/create/55

esenliyim commented 2 years ago

Good write-up.

So just for clarification, were you using a flatpak/snap/whatever package of Spotify on Fedora 35 too? And the logo worked then?

As for the GTK4 icon browser here, that thing is unfortunately telling you nothing. It doesn't show the Spotify icon on my system either, but there it is, being displayed just fine by the extension:

image

I'll look into the permission and #28 when I have the time.

e7d commented 2 years ago

I'm using the flatpak version now, but I know I did switch from a dnf installed package to the flatpak version at some point, while I was still using Fedora 35. And i can not quite remember if the logo still was showing after that switch. :thinking: I'll try in a brand new Fedora 35 VM and let you know.

esenliyim commented 2 years ago

The logo is a relatively new feature. April 7th, according to #20. If you've made the switch before that, you've always used it with a containerized package.

e7d commented 2 years ago

Well, I took the time to test again both installation methods. They are listed here btw: https://docs.fedoraproject.org/en-US/quick-docs/installing-spotify/#_using_the_rpm_fusion_repository

I started by installing both packages side by side, as their disk location are completely different. The Spotify does not show, whatever the version started, even having only one of them running at a time, in case running both of them concurrently could mess up the detection for whatever reason.

By the way, the metadata of your plugin always reacts correctly to this "concurrency situation". Whatever the client used, the other one, as well as your plugin syncs up right away with the good information. Nice to see.

Following your previous comment, I then uninstalled the flatpak version completely, and restarted the VM for good measure, so the one installed through "local package factory" would be the only one in place. Still no logo.

Finally, and to be thorough, I did the opposite and removed any trace of the "lpf-spotify-client" and its build "spotify-client" packages. I installed back the Flatpak package, and restarted the VM. No logo again.

I don't know if my memory is playing tricks on me, but I'm pretty sure I saw this Spotify logo show up some day, and yet i tried every combination of what I used past months. I shall say I'm quite confused now.

esenliyim commented 2 years ago

I know this is gonna sound like "did you turn it off and back on again", but I'm gonna ask it anyway just to make sure.

You did remember to actually set the logo to be shown, right? Because a few commits back I've set it to be hidden by default.

If you did, then that is very confusing.

e7d commented 2 years ago

I know this is gonna sound like "did you turn it off and back on again", but I'm gonna ask it anyway just to make sure.

Yeah, I did. Without any luck.

You did remember to actually set the logo to be shown, right? Because a few commits back I've set it to be hidden by default. If you did, then that is very confusing.

I'm actually quite confused by my own memories of what happened. As you said you hid the logo by default, that could have mess up my understanding of what happened at that time even more. I'm not sure anymore of what to think. :shrug:

What I am certain of is that whatever the way I install Spotify on a fresh Fedora 36, I can not get the logo to show up.

esenliyim commented 2 years ago

Solved this one too, at least partially. Turns out the app icon of the flatpak build is very easy to get. You get it the same way you do the "normal" icon, it's just the name that's different. Adding a single line of code did it.

Snap isn't that easy though, and I haven't tried with AppImage as I believe there isn't an official build for it. Leaving the issue open until I can get it working with Snap too.

esenliyim commented 2 years ago

Okay I'm getting close with Snap as well.

The solution I currently have is to check for Spotify's .desktop file where snapd stores those. If it exists, then I read the location of the icon off of it. I feel it's a rather overengineered solution, but I can't bake the icon's absolute path into the code and go straight for it, because the path includes what I'm pretty sure is a version number that changes from version to version. That'd break with the next update.

Maybe I'm dumb or haven't looked into it enough, but that's the best I got at the moment.

e7d commented 2 years ago

Solved this one too, at least partially. Turns out the app icon of the flatpak build is very easy to get. You get it the same way you do the "normal" icon, it's just the name that's different. Adding a single line of code did it.

Snap isn't that easy though, and I haven't tried with AppImage as I believe there isn't an official build for it. Leaving the issue open until I can get it working with Snap too.

That did the trick for my flatpak installation, thanks.

brw commented 7 months ago

I know this is a bit of an old issue, but I noticed that the Spotify icon also isn't shown for my installation. I think it might be because I'm running Spotify through spotify-launcher (as mentioned in the Arch wiki, and it makes it easier to work with Spicetify), which installs Spotify to $HOME/.local/share/spotify-launcher/install. The .desktop file is /usr/share/applications/spotify-launcher.desktop instead of spotify.desktop (which is located at $HOME/.local/share/spotify-launcher/install/usr/share/spotify/spotify.desktop, but unused). Was just wondering if this is also the same issue.

image