twolfson / google-music-electron

Desktop app for Google Music on top of Electron
The Unlicense
262 stars 40 forks source link

Failed to bind shortcut #45

Open fcastilloec opened 7 years ago

fcastilloec commented 7 years ago

When loading the app from console, I get the errors:

2017-07-30T23:22:47.772Z - warn: Failed to bind mediaplaypause shortcut 2017-07-30T23:22:47.775Z - warn: Failed to bind medianexttrack shortcut 2017-07-30T23:22:47.776Z - warn: Failed to bind mediaprevioustrack shortcut

And because of this, I can't use my media keys to control the app. I don't have MPRIS and I don't want to install it and/or use it. I'm running the app on Ubuntu 16.04, node v6.11.1, npm v3.10.10

twolfson commented 7 years ago

Typically bindings fail due to another application taking the existing bindings. Be sure to close out of any other applications that might steal those bindings first (e.g. music players, browsers)

fcastilloec commented 7 years ago

This is still an issue. The mediaplyapause shortcut is bounded by the OS, so I can't quit it in order for this app to get the binding first. There should be a way to receive OS bound shortcuts into electron. Other apps do it. As an example, simply install two music players on linux. Run each separately and they both can be controlled by the media keys; even if they are running simultaneously, the first one opened will receive the keys and function properly.

twolfson commented 7 years ago

Ah, sorry I misunderstood your question. We support choosing alternative media key shortcuts via our Preferences window (menu bar -> File -> Preferences)

fcastilloec commented 7 years ago

That's a good workaround but the issue is still there. I would like to control this player like I control any other one. In the meantime, I'll have to change the shortcuts. Nonetheless, I think this bug should remain open, I could edit it so it shows that what we want is being able to control the app just like any other music app, using the same controls as the other apps do. It's just a better user experience overall, instead of re-learning new shortcuts. My user experience went like this: realizing that there's something wrong with the shortcuts, not knowing what's the problem, hours of googling and bug hunting, cloning the github repository to debug the problem, posting a bug, realize that I should change the shortcuts. This is something we shouldn't expect from everyday users.

twolfson commented 7 years ago

I understand your experience/frustrations but I don't think there's much we can do:

Since our application is still CLI based, I think the "WARN" console messages at startup surface this info the user pretty well for now

fcastilloec commented 7 years ago

@twolfson I've submitted a patch for this issue in another project headsetapp/headset-electron based on this file Google-Play-Music-Desktop-Player-UNOFFICIAL-/mediaKeysDBus.js You'll have to either grab the key bindings in the traditional way for all systems and on Linux use the dbus approach.

twolfson commented 7 years ago

While that functionality works with a single app, I believe it would cause multiple music apps listening to DBus to receive the same event and start playing thus defeating the purpose

fcastilloec commented 7 years ago

From my experience, the command GrabMediaPlayerKeys on dbus is binding the MediaKeys, so if there are multiple media apps listening only the one that opened first will grab them and perform the function. This is similar to how electron grabs the keys but done through dbus, if an app already has a hold of the keys, they won't be able to grab them through dbus You can easily test this by having a couple of music apps open and pressing one of the MediaKeys to see what happens. I've tried with headsetapp, Clementine, totem, and Spotify for Linux.

twolfson commented 7 years ago

Ah, I think I understand now. I'm currently swamped with other priorities at the moment. I'm going to reopen this issue and mark it as "Help Wanted". Any PRs are welcome

fcastilloec commented 7 years ago

Great! I'll try to get a shot at it if I have time and submit a PR, but I'm also busy at the moment.