ytmdesktop
ytmdesktop copied to clipboard
Bug: macOS media-buttons stop working
app: 1.11.0 macOS: 10.15.5
Looks like upgrading electron causes media-buttons stop working
Downgrading to electron^7.2.4, electron-builder^21.2.0 brings it to life
electron/electron#24052
Thanks for the info, i will check
I think I'm experiencing this same bug. When I press my media keys (Mac Das Keyboard), iTunes opens.
The same issue here. When I press any media keys, iTunes opens.
Same issue :)
Same issue.
App v1.9.0, macOS v10.15.6.
Still a problem in 1.12
On the electron page, they explain what happened
The following accelerators will not be registered successfully on macOS 10.14 Mojave unless the app has been authorized as a trusted accessibility client: "Media Play/Pause" "Media Next Track" "Media Previous Track" "Media Stop"
Please read this: https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html
Thanks for your comment - I don't know if I interpreted it correctly but I responded by opening Security & Privacy prefs on my Mac, selecting Privacy, and enabling the app under Accessibility. The media keys still don't work.

Hello there, I have the same issue. When I try to use the Play/Pause Button iTunes opens. Next / Previous song doesn't work at all. I'm on the version 1.12.1 Accessibility for ytmdesktop is activated.
Any suggestions?
Cheers,
+1, exactly what @haiGodzilla said
Same here with latest version on MacOS 10.14.6 (18G6020)
I'm investigating this problem, unfortunately for me it's difficult to validate because I don't have a mac, but I'm doing my best to avoid problems
I've tried fiddling with it on my mac, can't make it work with the electron version used.
It's going to be fixed in an upcoming v10.x.x according to https://github.com/electron/electron/pull/24145.
By the way, in your code you forgot to call systemPreferences.isTrustedAccessibilityClient(true)
which checks if the app is a TrustedAccessibilityClient (the true
argument just prompt a system dialog telling the user where to go an set that if it's not trusted) on macOS, because you can't register media keys if the app doesn't have the Accessibility rights.
I will implement, thank you
Perfect, if you need me to quickly test your fixes when the newer version of electron is released, ping me.
I made a small experiment here and tested app.isTrustedAccessibilityClient(true)
and built locally to test.
if (isMac()) {
settingsProvider.set(
'settings-shiny-tray-dark',
nativeTheme.shouldUseDarkColors
)
systemPreferences.subscribeNotification(
'AppleInterfaceThemeChangedNotification',
function theThemeHasChanged() {
settingsProvider.set(
'settings-shiny-tray-dark',
nativeTheme.shouldUseDarkColors
)
updateStatusBar()
}
)
const menu = Menu.buildFromTemplate(statusBarMenu)
Menu.setApplicationMenu(menu)
systemPreferences.isTrustedAccessibilityClient(true); // check if is trusted
}
I can confirm that app shows the prompt and I'm able to allow access on System Preferences, but still not able to use fn key to play/pause songs. Itunes open instead. Not sure if checkDoubleTapPlayPause
function is triggered or not. If I try to use the alternative shortcut (CMD+SHIFT+SPACE in my case), it works.
There is no much topics about this problem, every one I found related to same resolution. But it seems this resolution does not work.
@juliovedovatto It depends on the version of electron you used. The media keys don't work on macOS in electron 10.
The fix https://github.com/electron/electron/pull/24145 was merged into master at the end of August, but hasn't been backported to the stable branches yet (10 and 9).
The first electron version in which it was landed is the https://github.com/electron/electron/releases/tag/v11.0.0-beta.1, but electron v11 is still in beta.
@tex0l thanks for the feedback. I checked some topics, but I was not sure if they already fixed for the future versions.
I just tested with Electron 11.0.0-beta.11
and worked as expected.
For now it is good for me, I'll use my custom build and keep an eye when they release oficially.
This is still broken for me in 1.13.0 installed from homebrew. Is there an ETA for a build with a sufficiently new electron? From the above it sounds like the problem is well understood and the fix for it already in the pipeline.
The media keys work fine for me when playing from a youtube music browser tab. As such this app is a non-starter to me. I hope someone will prioritise giving this some love. The app looks promising.
Electron v11 was released on 16 Nov and is up to v11.0.3, so presumably the next release will have this fix (although the development
branch is still on v10 right now).
I just tried with the 1.14.0 beta and seems that this got fixed https://github.com/ytmdesktop/ytmdesktop/releases/tag/v1.14.0
Working for me also, but for anyone having troubles with the beta you must still have YTM added under Accessibility as per comment: https://github.com/ytmdesktop/ytmdesktop/issues/205#issuecomment-671038856
I didn't have this added initially and it was a no go.
Can confirm that media keys work correctly in 1.14.0
.
In my case I had to remove and re-add YTMDP in accessibility settings
Media keys working as expected in 1.14.0
. I can finally ditch the custom build I made.
I had to do the same thing that @coagmano did in order to make the media keys to work again, YTMD did not ask for permissions.
Can confirm that permission under privacy/accessibility needed to be set in MacOS for the media keys to work. Interestingly the alternate hotkey <cmd + shift + space> worked without.
the beta link for mac worked for me. @AlejandroRuiz thx!
Media keys in 1.14.0
stopped working for me after I upgraded to use Big Sur. But the following helped me fix this.
Settings -> Security & Privacy -> Input Monitoring -> Add Youtube Music Desktop App.
@rjzheng this worked perfectly. Thank you so much! :)
Is 1.14.0 still concider nightly build? I'm installing through brew and they only have 1.13.0 release. I was thinking to submit latest version if that works but I don't think brew wants unstable versions.