Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media keys can't be bound with global-shortcut #5268

Closed
Limero opened this issue Apr 23, 2016 · 5 comments
Closed

Media keys can't be bound with global-shortcut #5268

Limero opened this issue Apr 23, 2016 · 5 comments

Comments

@Limero
Copy link

Limero commented Apr 23, 2016

I'm unable to bind any of the media keys with global-shortcut (medianexttrack, mediaplaypause, mediaprevioustrack and mediastop). Other keys like 'CommandOrControl+X' works as they should. The same problem exists even if no other applications are open, so there shouldn't be another music app blocking it.

I have tested binding with the 'proof of concept' mentioned in #3941 with the same results, so my implementation is correct.

When you press the media keys without anything open on Gnome, this image is shown on the screen: http://i.imgur.com/9Giv4LS.jpg
Maybe showing that icon counts as a bind, making Electron think it's already in use?

  • Electron version: 0.37.7
  • Operating system: Arch Linux x64
  • Desktop Environment: Gnome 3.20
@MarshallOfSound
Copy link
Member

@Limero
Copy link
Author

Limero commented Apr 24, 2016

Thank you for your reply!
If it's because of dbus, there must be something that could be done upstream to solve it.
Dbus is a dependency of both systemd and chromium (at least on Arch Linux) so it should affect all Arch Linux (probably more distros) users of Electron. It shouldn't be requiring a hack in the application to fix it.

@MarshallOfSound
Copy link
Member

@Limero If you read the global shortcut documentation --> https://github.com/electron/electron/blob/master/docs/api/global-shortcut.md

It says

When the accelerator is already taken by other applications, this call will silently fail. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.

Basically if any other program has claimed shortcuts you can't have them. This is intended behaviour and not a bug in electron 👍

@Limero
Copy link
Author

Limero commented Apr 24, 2016

I understand that, but there should be something Linux specific in Electron that overwrites binds by dbus, if this is something that affects all Linux users. That way, every application doesn't have to implement their own fix. If dbus later stops with this behavior, Electron can remove the fix and all applications dependent on it will continue to work.

@zcbenz
Copy link
Member

zcbenz commented Apr 25, 2016

It would be nice to be able to work around this in Electron, but that's a bit outside globalShortcut's original design and we won't do it ourselves. However PRs to add it will be appreciated.

And thank @MarshallOfSound for pasting your awesome solution!

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

No branches or pull requests

3 participants