spotify-qt icon indicating copy to clipboard operation
spotify-qt copied to clipboard

AppImage hardware media buttons does not seem to work / no media controls

Open sunjerry019 opened this issue 1 year ago • 1 comments

System information

System Platform: Linux Distro: AlmaLinux 9.4 DE: KDE Plasma 5.27.11 / KDE Frameworks 5.115.0 on X11

This issue has also been reproduced on: Platform: Linux Distro: Arch Linux DE: GNOME 46 on X11

App Version AppImage, spotify-qt v3.11 Built using Qt 6.6.1 Commit 83bfc5df Built on Dec 31 2023

Backend: librespot 0.4.2 installed via flatpak

Output from spotify-qt

ABI             : x86_64-little_endian-lp64
App version     : v3.11 (83bfc5df)
Build type      : Release
Current desktop : KDE
D-Bus support   : Yes
Device          : spotify-qt (librespot) (Speaker)
KCrash support  : No
Kernel          : linux 5.14.0-427.22.1.el9_4.x86_64
Keychain support: Yes
Platform        : xcb
Product         : AlmaLinux 9.4 (Seafoam Ocelot)
Qt version      : 6.6.1

Detailed information

Hardware media buttons do not work. The DE also doesn't seem to realize that spotify-qt is playing media that could be paused/played/...

Could be related to #119

What happens?

After starting to play, hardware buttons for "Play/Pause", "Next" and "Previous" do not cause any change in spotify-qt (no reaction at all), whether inside or outside the window. Application logs and Spotify logs also do not show anything when the hardware buttons are pressed.

As a further sign, playing a song in spotify-qt doesn't show media control buttons, only volume control:

Playback in spotify-qt

xev shows that the hardware button is indeed seen by the system:

...
KeymapNotify event, serial 43, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   16  0   0   0   0   0   0   0   0   0   0   

KeyRelease event, serial 43, synthetic NO, window 0x6000001,
    root 0x278, subw 0x0, time 272640855, (-353,73), root:(838,694),
    state 0x2010, keycode 172 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MappingNotify event, serial 43, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248
...

What should happen?

Hardware media control buttons should work, and media control buttons should be available.

For example, playing the same song through Firefox/Spotify Web shows this:

Playback in Spotify Web

Thanks for looking into this!

sunjerry019 avatar Jul 05 '24 15:07 sunjerry019

Same problem on Arch Linux/KDE after installing spotify-qt from AUR. It recompiled everything, so guess it's not only the appimage that is at fault here.

TamtamHero avatar Apr 04 '25 12:04 TamtamHero

i did some investigation into this issue. note that spotify-qt --play-pause from the CLI also doesn't work (it prints "spotify-qt is not running"). the proximate cause is that the QDBusInterface in MediaPlayer.interface doesn't work (it always returns false for isValid).

i haven't yet figured out why the DBus interface is broken.

jyn514 avatar Jul 28 '25 17:07 jyn514

i see these logs from dbus-monitor which are likely related:

method call time=1753723923.344407 sender=:1.948 -> destination=org.freedesktop.DBus serial=1 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=Hello
method return time=1753723923.344414 sender=org.freedesktop.DBus -> destination=:1.948 serial=4294967295 reply_serial=1
   string ":1.948"
signal time=1753723923.344421 sender=org.freedesktop.DBus -> destination=(null destination) serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.948"
   string ""
   string ":1.948"
signal time=1753723923.344428 sender=org.freedesktop.DBus -> destination=:1.948 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.948"
method call time=1753723923.344557 sender=:1.948 -> destination=org.mpris.MediaPlayer2.spotify-qt serial=2 path=/org/mpris/MediaPlayer2; interface=org.freedesktop.DBus.Introspectable; member=Introspect
error time=1753723923.344565 sender=org.freedesktop.DBus -> destination=:1.948 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=2
   string "The name is not activatable"
method call time=1753723923.344668 sender=:1.948 -> destination=org.freedesktop.DBus serial=3 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.mpris.MediaPlayer2.spotify-qt'"
method call time=1753723923.344714 sender=:1.948 -> destination=org.freedesktop.DBus serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.mpris.MediaPlayer2.spotify-qt"
error time=1753723923.344720 sender=org.freedesktop.DBus -> destination=:1.948 error_name=org.freedesktop.DBus.Error.NameHasNoOwner reply_serial=4
   string "The name does not have an owner"
method call time=1753723923.344877 sender=:1.948 -> destination=org.mpris.MediaPlayer2.spotify-qt serial=5 path=/org/mpris/MediaPlayer2; interface=org.mpris.MediaPlayer2.Player; member=PlayPause
error time=1753723923.344880 sender=org.freedesktop.DBus -> destination=:1.948 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=5
   string "The name is not activatable"
method call time=1753723923.344958 sender=:1.948 -> destination=org.freedesktop.DBus serial=6 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.mpris.MediaPlayer2.spotify-qt'"
method call time=1753723923.344970 sender=:1.948 -> destination=org.freedesktop.DBus serial=7 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.DBus'"

jyn514 avatar Jul 28 '25 17:07 jyn514

i suspect the problem is that the dbus-mpris section of snap/snapcraft.yaml is needed in order for Qt6 to respond to the Introspect call. that would also explain why it only works for some people - it works if you install through snap.

that said, i tried installing through snap and it only had 3.12 packaged, which hit #292. so i wasn't able to verify that the snap version fixed this issue.

jyn514 avatar Jul 29 '25 11:07 jyn514