Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Failed to bind shortcut #45

Open
fcastilloec opened this issue Jul 30, 2017 · 10 comments
Open

Failed to bind shortcut #45

fcastilloec opened this issue Jul 30, 2017 · 10 comments

Comments

@fcastilloec
Copy link

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
Copy link
Owner

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
Copy link
Author

fcastilloec commented Jul 31, 2017

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
Copy link
Owner

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

@fcastilloec
Copy link
Author

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
Copy link
Owner

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

  • With respect to forcing control of global shortcuts from other apps, I don't think this is possible. Otherwise, deadlocks could easily occur
  • We could surface UI based notifications about failed bindings but if it's a feature someone doesn't care about, then it might be more annoying than valuable

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
Copy link
Author

fcastilloec commented Aug 2, 2017

@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
Copy link
Owner

twolfson commented Aug 3, 2017

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
Copy link
Author

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
Copy link
Owner

twolfson commented Aug 4, 2017

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
Copy link
Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants