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
fix: global shortcut media keys working with accessibility #24145
Conversation
8cd87f1
to
dca1fa0
Compare
6f679ce
to
b19407f
Compare
b19407f
to
8855d3a
Compare
ff45ef9
to
9ae76b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just blocking temporarily until I can test this out a bit. Just want some manual sanity checks on the expected behavior here
@MarshallOfSound Hello, I do not mean to pester, I am just looking for an update on if this will be merged soon, as it has been manually blocked for about a month. Thank you :) |
9ae76b7
to
e36b4a6
Compare
Release Notes Persisted
|
I was unable to backport this PR to "10-x-y" cleanly; |
I was unable to backport this PR to "9-x-y" cleanly; |
Description of Change
Closes #24052.
Initially, I tried to fix this in #21442, by patching out Chromium's usage of
RemoteCommandCenterDelegate
entirely, as it usesMPRemoteCommandCenter
in a change added in this CL.MPRemoteCommandCenter
makes it such thatglobalShortcuts
in Electron will not work as intended, because by design an app does not receive remote control events until it begins playing audio. However, as of macOS Catalina, the alternate implementation requires accessibility access to have been granted, which means that it created a situation where simply trying to watch a YouTube video and hitting play/pause would trigger Electron to request a user for Accessibility permissions. For many large apps this is extremely undesirable behavior.This second-pass solution splits the difference. What we want is for unilateral override only when registering
globalShortcuts
, which means disabling internal media key handling specifically in that use case. Chromium's media key listener manager already kept track ofmedia_key_handling_enabled
as a member, so I added a new static method toGlobalShortcutListenerMac
that allows us to enable and disable it when registering and unregistering shortcuts. Then, we can ensure it's off when registering global shortcuts, and on otherwise (preserving previous behavior).Tested with https://gist.github.com/codebytere/a7e33c6f03a84dbcc2878859237422dd.
cc @MarshallOfSound @ckerr @zcbenz
Checklist
npm test
passesRelease Notes
Notes: Fixed media keys working unilaterally when registered with
globalShortcut