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

fix: MediaKey globalShortcuts not working on macOS #21442

Merged
merged 1 commit into from Dec 11, 2019
Merged

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Dec 9, 2019

Description of Change

Closes #20788.

This PR overrides MediaKeysListener::IsMediaKeycode to also listen for VolumeUp, VolumeDown, and VolumeMute.

We also need to patch out Chromium's usage of RemoteCommandCenterDelegate, as it uses MPRemoteCommandCenter in a change added in this CL. MPRemoteCommandCenter makes it such that globalShortcuts in Electron will not work as intended, because by design an app does not receive remote control events until it begins playing audio. This means that a media shortcut would not kick into effect until you, for example, began playing a YouTube video which sort of defeats the purpose of globalShortcuts.

Checklist

Release Notes

Notes: Fixed media-specific globalShortcuts not working on macOS.

@codebytere codebytere requested a review from a team as a code owner December 9, 2019 18:59
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Dec 9, 2019
+// `ui::Accelerator`, rather than `extensions::Command`.
+
+// static
+bool Command::IsMediaKey(const ui::Accelerator& accelerator) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsMediaKey in Chromium now invokes IsMediaKeyCode which is also used in other places, so it makes more sense to override there instead of at the IsMediaKey level.

Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

patches/chromium/command-ismediakey.patch Show resolved Hide resolved
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Dec 10, 2019
@codebytere codebytere force-pushed the fix-media-shortcuts branch 2 times, most recently from f1b21ed to 8d51e81 Compare December 11, 2019 02:08
@zcbenz zcbenz merged commit cbe1e3a into master Dec 11, 2019
@release-clerk
Copy link

release-clerk bot commented Dec 11, 2019

Release Notes Persisted

Fixed media-specific globalShortcuts not working on macOS.

@zcbenz zcbenz deleted the fix-media-shortcuts branch December 11, 2019 06:49
@trop
Copy link
Contributor

trop bot commented Dec 11, 2019

I was unable to backport this PR to "6-1-x" cleanly;
you will need to perform this backport manually.

@trop trop bot removed the target/6-1-x label Dec 11, 2019
@trop
Copy link
Contributor

trop bot commented Dec 11, 2019

I was unable to backport this PR to "7-1-x" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Dec 11, 2019

I was unable to backport this PR to "8-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Dec 16, 2019

@codebytere has manually backported this PR to "8-x-y", please check out #21547

@trop
Copy link
Contributor

trop bot commented Dec 16, 2019

@codebytere has manually backported this PR to "7-1-x", please check out #21548

@trop
Copy link
Contributor

trop bot commented Jan 7, 2020

@codebytere has manually backported this PR to "6-1-x", please check out #21690

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

Successfully merging this pull request may close these issues.

Media key global shortcut no longer working on macOS
3 participants