flathub / com.spotify.Client

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

Spotify wayland has no themed cursor #239

Open etrnal70 opened 1 year ago

etrnal70 commented 1 year ago

It's nice to see spotify finally supports wayland ootb (just toggling wayland socket from flatseal). One thing that i notice is that using wayland will reset the cursor to the default, black one.

This isn't an issue when using xwayland

daenney commented 1 year ago

I get the impression that simply flicking the Wayland socket on doesn't actually make it run with Wayland. I tried this myself as it's one of the last remaining XWayland apps. But after setting the override and relaunching the app I still see it in the output of xlsclients.

Did you do something else to make this work by any chance?

TingPing commented 1 year ago

At least with the current verison, it does not support wayland AFAICT.

vially commented 1 year ago

At least with the current verison, it does not support wayland AFAICT.

Actually it does work, but you need to manually pass in the Electron wayland flags. This is a sample desktop file for doing that (~/.local/share/applications/com.spotify.Client.desktop):

[Desktop Entry]
Type=Application
Name=Spotify
GenericName=Online music streaming service
Comment=Access all of your favorite music
Icon=com.spotify.Client
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=/app/extra/bin/spotify --file-forwarding com.spotify.Client --ozone-platform=wayland @@u %U @@
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;AudioVideo;
Keywords=Music;Player;Streaming;Online;
StartupWMClass=Spotify
X-GNOME-UsesNotifications=true
X-Flatpak-Tags=proprietary;
X-Flatpak=com.spotify.Client
TingPing commented 1 year ago

Ah neat.

Testing it locally it shows corrupted rendering and then crashes though.

Once its broadly usable we should add detecting wayland to our launcher scripts.

vially commented 1 year ago

Testing it locally it shows corrupted rendering and then crashes though.

That's strange. Seems to work fine for me on sway.

orowith2os commented 1 year ago

Once its broadly usable we should add detecting wayland to our launcher scripts.

Why not add it now, but not enable it by default? Apparenty it works for some people, and it can be a simple override to allow it.

orowith2os commented 1 year ago

@etrnal70: where are your themes located? They should be in the appropriate XDG directories, not in directories like ~/.icons. Flatpak won't work with the legacy directories.

TingPing commented 1 year ago

@orowith2os Patch welcome. See Discord package for example. It even has a workaround for this bug.

orowith2os commented 1 year ago

Indeed it does. I've submitted something upstream to Flatpak a while back, I think before this issue ever showed up. https://github.com/flatpak/flatpak/pull/5375

etrnal70 commented 1 year ago

@etrnal70: where are your themes located? They should be in the appropriate XDG directories, not in directories like ~/.icons. Flatpak won't work with the legacy directories.

I believe they are placed in the default /usr/share/icons directory

etrnal70 commented 1 year ago

It got fixed in latest update ! Closing this then

EDIT: Nah no it's on xwayland. It's doesn't even use wayland now (even with flags)

juxuanu commented 1 year ago

You can run spotify on wayland with flatpak run 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.

I recommend using the same method Discord Flatpak uses, which works fine, which tweaked for Spotify (since it's not Electron, but an older CEF) would look like:

FLAGS='--enable-gpu-rasterization --enable-zero-copy --enable-gpu-compositing --enable-native-gpu-memory-buffers --enable-oop-rasterization --enable-features=UseSkiaRenderer '

WAYLAND_SOCKET=${WAYLAND_DISPLAY:-"wayland-0"}

if [[ -e "$XDG_RUNTIME_DIR/${WAYLAND_SOCKET}" ]]
then
    FLAGS="$FLAGS --ozone-platform=wayland"
fi

if [[ $XDG_SESSION_TYPE == "wayland" ]] && [ -c /dev/nvidia0 ]
then
    FLAGS="$FLAGS --disable-gpu-sandbox"
fi

imatge

trevnels commented 1 year ago

I noticed the unthemed cursor behavior too with most chromium-based apps running under Wayland (notably also Discord). The fix for me was to add XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons as an environment variable to affected flatpaks, though YMMV. Seems a little weird to be passing X-related variables into a full Wayland client but it seems to work.

orowith2os commented 1 year ago

They're not exactly X-only, they were just grandfathered in; they're still valid variables on Wayland, and I don't think there's any other alternative to em. They work fine, no reason to not use em.

Keeping in mind this only applies to some X variables, like XCURSOR_PATH.

sakithb commented 10 months ago

You can run spotify on wayland with flatpak run 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.

I recommend using the same method Discord Flatpak uses, which works fine, which tweaked for Spotify (since it's not Electron, but an older CEF) would look like:

FLAGS='--enable-gpu-rasterization --enable-zero-copy --enable-gpu-compositing --enable-native-gpu-memory-buffers --enable-oop-rasterization --enable-features=UseSkiaRenderer '

WAYLAND_SOCKET=${WAYLAND_DISPLAY:-"wayland-0"}

if [[ -e "$XDG_RUNTIME_DIR/${WAYLAND_SOCKET}" ]]
then
    FLAGS="$FLAGS --ozone-platform=wayland"
fi

if [[ $XDG_SESSION_TYPE == "wayland" ]] && [ -c /dev/nvidia0 ]
then
    FLAGS="$FLAGS --disable-gpu-sandbox"
fi

imatge

I managed to launch spotify on wayland. Is there any way to remove the default chromium titlebar?

TingPing commented 10 months ago

I managed to launch spotify on wayland. Is there any way to remove the default chromium titlebar?

Maybe --enable-features=UseSkiaRenderer,WaylandWindowDecorations

Bu156 commented 10 months ago

WaylandWindowDecorations seems to do nothing, otherwise Spotify in Wayland mode is a much better experience for me, as games can't grab the input from Spotify in the background.

ahjolinna commented 7 months ago

You can run spotify on wayland with flatpak run 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. I recommend using the same method Discord Flatpak uses, which works fine, which tweaked for Spotify (since it's not Electron, but an older CEF) would look like:

FLAGS='--enable-gpu-rasterization --enable-zero-copy --enable-gpu-compositing --enable-native-gpu-memory-buffers --enable-oop-rasterization --enable-features=UseSkiaRenderer '

WAYLAND_SOCKET=${WAYLAND_DISPLAY:-"wayland-0"}

if [[ -e "$XDG_RUNTIME_DIR/${WAYLAND_SOCKET}" ]]
then
    FLAGS="$FLAGS --ozone-platform=wayland"
fi

if [[ $XDG_SESSION_TYPE == "wayland" ]] && [ -c /dev/nvidia0 ]
then
    FLAGS="$FLAGS --disable-gpu-sandbox"
fi

imatge

I managed to launch spotify on wayland. Is there any way to remove the default chromium titlebar?

when I launched the spotify with wayland using these settings on plasma6 (using Nvidia GPU) it seems to get rid of the horrible xwayland flickering issue thats on nvidia, and it runs much smoother in general

would be nice if this could be added, or at least be opt-in as discord has

only minor issue is I notice is that now you will see the generic Wayland icons, not sure if its app bug or what


my spec:

Operating System: openSUSE MicroOS 20240226
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.6-1-default (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700G with Radeon Graphics
Memory: 46.8 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2
TingPing commented 7 months ago

would be nice if this could be added, or at least be opt-in as discord has

Please open a PR doing the same.

hoshsadiq commented 5 months ago

When running with all of this, my cursor is in the wrong place. It's the correct size and theme, but the hovers and clicks register in different places from where my cursor is. In some cases, it's a couple of inches (15 inch screen) to the bottom right of the cursor, but in others places it's 4-5 inches away. I do get some errors when running on the command line:

$ flatpak run --user --socket=wayland --nosocket=x11 --env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons com.spotify.Client
/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

Traceback (most recent call last):
  File "/app/bin/set-dark-theme-variant.py", line 11, in <module>
    disp = Xlib.display.Display()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/Xlib/display.py", line 89, in __init__
    self.display = _BaseDisplay(display)
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/Xlib/display.py", line 71, in __init__
    protocol_display.Display.__init__(self, *args, **keys)
  File "/app/lib/python3.11/site-packages/Xlib/protocol/display.py", line 84, in __init__
    name, protocol, host, displayno, screenno = connect.get_display(display)
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/Xlib/support/connect.py", line 73, in get_display
    return mod.get_display(display)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/Xlib/support/unix_connect.py", line 59, in get_display
    raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name ""
/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
Opening in existing browser session.
libnotify-Message: 10:44:28.035: App Name is not available when using Portal Notifications