flathub / com.spotify.Client

https://flathub.org/apps/details/com.spotify.Client
68 stars 34 forks source link

(at least) opt-in for wayland support #275

Open ahjolinna opened 4 months ago

ahjolinna commented 4 months ago

follow up on previous discussion in issue https://github.com/flathub/com.spotify.Client/issues/239#issuecomment-1968125266, I'm suggesting the addition of Wayland support.

Enabling Wayland support, even optionally, would significantly enhance the user experience, especially for NVIDIA users who currently experience xwayland flickering and it would lead to a smoother and more stable performance overall.

I did notice a minor issue with the display of generic Wayland icons, but I believe this can be addressed

LoneWolf4713 commented 3 months ago

I second this, on my Arch Linux machine, spotify running under XWayland takes 800MB - 1GB of memory, that is too much for a music player..... but I've had experiences where native wayland version of some apps consumed way less memory than Xwayland versions. I'm on Arch Linux with Hyprland. Running Spotify Flatpak.

Erick555 commented 3 months ago

Note that everyone can opt-in already by adding relevant flags in config

justin13888 commented 3 months ago

I second this, on my Arch Linux machine, spotify running under XWayland takes 800MB - 1GB of memory, that is too much for a music player..... but I've had experiences where native wayland version of some apps consumed way less memory than Xwayland versions. I'm on Arch Linux with Hyprland. Running Spotify Flatpak.

True! Didn't even notice it until you mentioned it lol. The biggest gripe for me is that in my multi-monitor setup, I'm forced to use fractional scaling which means blurry text on XWayland. I'm running GNOME 45 on Fedora 39 Workstation

justin13888 commented 3 months ago

Note that everyone can opt-in already by adding relevant flags in config

I haven't been able to get Wayland to work. What command were you using?

This command wouldn't open any window: flatpak run com.spotify.Client --enable-features=UseOzonePlatform --ozone-platform=wayland

This command would hang up my desktop environment (GNOME 45 on Wayland): flatpak run --socket=wayland com.spotify.Client --enable-features=UseOzonePlatform --ozone-platform=wayland

For reference, I'm running version the latest version as of writing (version 1.2.31) on FlatHub and the Spotify snap version works besides improperly styled window decoration.

Erick555 commented 3 months ago

To match what discord does (and what this issue proposes) try:

flatpak run --socket=wayland com.spotify.Client --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto

LoneWolf4713 commented 3 months ago

Hi, @justin13888 's answer is correct and this below produces no window.

❯ flatpak run com.spotify.Client --enable-features=UseOzonePlatform --ozone-platform=wayland

/app/extra/bin/spotify: /usr/lib/x86_64-linux-gnu/libcurl.so.4: no version information available (required by /app/extra/bin/spotify)
~
❯ [spotifywm] attached to spotify
/app/extra/share/spotify/spotify: /usr/lib/x86_64-linux-gnu/libcurl.so.4: no version information available (required by /app/extra/share/spotify/spotify)
/app/extra/share/spotify/spotify: /usr/lib/x86_64-linux-gnu/libcurl.so.4: no version information available (required by /app/extra/share/spotify/spotify)
[spotifywm] attached to spotify
[spotifywm] attached to spotify 

but as @Erick555 's answer produces a window that is still running in XWayland, here is the output:

 ❯ flatpak run --socket=wayland com.spotify.Client --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto

/app/extra/bin/spotify: /usr/lib/x86_64-linux-gnu/libcurl.so.4: no version information available (required by /app/extra/bin/spotify)
~
❯ [spotifywm] attached to spotify
/app/extra/share/spotify/spotify: /usr/lib/x86_64-linux-gnu/libcurl.so.4: no version information available (required by /app/extra/share/spotify/spotify)
/app/extra/share/spotify/spotify: /usr/lib/x86_64-linux-gnu/libcurl.so.4: no version information available (required by /app/extra/share/spotify/spotify)
[spotifywm] attached to spotify
[spotifywm] attached to spotify
[spotifywm] spotify window a00004 found
/proc/self/exe: /usr/lib/x86_64-linux-gnu/libcurl.so.4: no version information available (required by /proc/self/exe)
~
❯ [spotifywm] attached to spotify
[spotifywm] spotify window 1000007 found
/app/bin/spotify: line 45: Xlib.xauth:: command not found

can anybody tell what I'm doing wrong here..?!

Erick555 commented 3 months ago

You may try to force wayland by: flatpak run --socket=wayland --nosocket=x11 com.spotify.Client --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto

LoneWolf4713 commented 3 months ago

None of the solutions on this page worked for me. I guess the Flatpak version doesn't support Wayland in a stable way yet. I ended up installing spotify AUR Package (not spotify-launcher). and it launches in native wayland beautifully with command: ❯ spotify --enable-features=UseOzonePlatform --ozone-platform=wayland

Also, it's resource usage is way less than Flatpak version too. @justin13888 . Around 300MB as compared to 700MB-1.5GB of Flatpak version. Hence it feels a lot snappier and faster than the Flatpak counterpart. I guess you can install AUR Version on any distro with a little tweaking.

Erick555 commented 3 months ago

I guess the Flatpak version doesn't support Wayland in a stable way yet. I ended up installing spotify AUR Package (not spotify-launcher).

You may note Flatpak has exact same spotify versions as AUR and snap.

ahjolinna commented 3 months ago

here is a fix for cursor scaling on wayland, for those who have HIDPI screen --env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons

https://github.com/electron/electron/issues/19810

ahjolinna commented 3 months ago

I used this and it works for me

flatpak run --branch=stable --socket=wayland --arch=x86_64 --command=/app/extra/bin/spotify --file-forwarding com.spotify.Client --enable-gpu-rasterization --enable-zero-copy --enable-gpu-compositing --enable-native-gpu-memory-buffers --enable-oop-rasterization --enable-features=UseSkiaRenderer --ozone-platform=wayland --disable-gpu-sandbox '--enable-features=UseSkiaRenderer,WaylandWindowDecorations
' @@u %U @@

... not sure if all of these are needed, anyway : --disable-gpu-sandbox is only needed if you are using the nvidia drivers

justin13888 commented 2 months ago

None of the solutions on this page worked for me. I guess the Flatpak version doesn't support Wayland in a stable way yet. I ended up installing spotify AUR Package (not spotify-launcher). and it launches in native wayland beautifully with command: ❯ spotify --enable-features=UseOzonePlatform --ozone-platform=wayland

Also, it's resource usage is way less than Flatpak version too. @justin13888 . Around 300MB as compared to 700MB-1.5GB of Flatpak version. Hence it feels a lot snappier and faster than the Flatpak counterpart. I guess you can install AUR Version on any distro with a little tweaking.

Interesting. I didn't notice how much RAM it's using until you mentioned!

justin13888 commented 2 months ago

I used this and it works for me

flatpak run --branch=stable --socket=wayland --arch=x86_64 --command=/app/extra/bin/spotify --file-forwarding com.spotify.Client --enable-gpu-rasterization --enable-zero-copy --enable-gpu-compositing --enable-native-gpu-memory-buffers --enable-oop-rasterization --enable-features=UseSkiaRenderer --ozone-platform=wayland --disable-gpu-sandbox '--enable-features=UseSkiaRenderer,WaylandWindowDecorations
' @@u %U @@

... not sure if all of these are needed, anyway : --disable-gpu-sandbox is only needed if you are using the nvidia drivers

Thanks! I could confirm this also works on my system (Fedora 39, with MESA AMD drivers)

daenney commented 2 months ago

Does anyone have cursor issues with this? I don't mean the cursor theme missing, I mean the cursor not clicking where you think it should be. It seems to be off by quite a lot, resulting in completely different UI elements being activated that aren't under the cursor.

hoshsadiq commented 2 months ago

I have the same issue, I commented in #239, but maybe this thread is more relevant to it.

FrankBrown321 commented 1 week ago

How to see spotify stats To see your Spotify stats, use Spotify Wrapped for annual highlights of your top songs, artists, and genres. For detailed, regular insights, try third-party sites like SpotiPie. Log in with your Spotify account to view your most-played tracks, hours listened, and more. Artists can use Spotify for Artists for detailed analytics.