(In reply to Jim Mathies [:jimm] (OOTO until Oct 7th) from comment #2)
For this, the legacy way was listening for WM_APPCOMANDs, but under Windows 10, my media keys did not trigger such a message.
According to MSDN this is supported under win10. I have a keyboard with such keys, maybe work up a test app we can throw around for people to test?
Yes, I will cobble together a test app containing WM_APPCOMANDS as well as evaluating the use of Raw Input (https://stackoverflow.com/a/41154576 something like this)
Also in Order to grab them when the window has no focus...
Why is this a requirement?
Because that is what "global" Hotkeys are about. Actually this bug is a dependant of https://bugzilla.mozilla.org/show_bug.cgi?id=1411795 (https://developer.chrome.com/apps/commands#scope)
(In reply to Jim Mathies [:jimm] (OOTO until Oct 7th) from comment #3)
The "linux-compat" method uses RegisterHotKey() which has exactly been made to listen for Hotkeys.
Feedback when hotkey could not be registered
Only listening for Keys that are required
Only one application can have a hotkey at a time, making it unavailable for other applications
This seems like a good approach with few tradeoff. You could register when media starts, and unregister when it stops.
Actually to clarify this: Now that I know better, Media Keys should not be any relevant for this, apart from support for Windows < 8.1 (W7, which is close to EOL), because there will be a better API which will handle Media Keys automatically and better.
So this is mainly for Web Extensions in general or maybe, depending on the API, anything within firefox in desire of global hotkeys.
I also like this method because it's easy. AKlotz has suggested evaluating RawInput as well, the discussion for this is on phabricator.