nukeop / nuclear

Streaming music player that finds free music for you
https://nuclear.js.org/
GNU Affero General Public License v3.0
12.02k stars 1.04k forks source link

Global next/previous track shortcuts #1604

Open MoonlitMonitor opened 4 months ago

MoonlitMonitor commented 4 months ago

One of my extra mouse buttons is mapped to play/pause. Whether or not I have Nuclear in focus, that mouse button can be used to play/pause in Nuclear, unless I have other sources playing in other programs.

However, two of the other extra mouse buttons are mapped to 'next track' and 'previous track', but I can only use these on Nuclear when the application is in focus.

It would be helpful if I could go to the next/previous track without having Nuclear in focus.

OS: Windows 11

nukeop commented 4 months ago

There's a method to do this but there's a caveat to making it multiplatform: https://www.electronjs.org/docs/latest/api/global-shortcut#globalshortcutregisteraccelerator-callback

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"

MoonlitMonitor commented 4 months ago

There's a method to do this but there's a caveat to making it multiplatform: https://www.electronjs.org/docs/latest/api/global-shortcut#globalshortcutregisteraccelerator-callback

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"

If I understood correctly, this doesn't seem to be a problem on Windows or Linux, but on macOS users would have to authorize the application by allowing it to use special permissions? If so, is that a security concern that would stop you from adding this feature?

nukeop commented 4 months ago

There are no security concerns here. If anyone wants to contribute this feature I'll be glad to merge it.

Packjackisback commented 4 months ago

Linux playerctl also lacks the ability to skip songs